To connect a NetConnection object to a remoting gateway set up a gateway connection using a Flash Remoting URL:
http://host[:port]/appName/[Gateway page]
Example URLs:
Note: When connecting to a remoting gateway the NetConnection.Connect method does not immediately communicate with the server. When a service function call is executed an HTTP connection to the application server is made. This connection only persists until the results of the call are returned to the client.
Sample
using FluorineFx.Net;
...
NetConnection netConnection = new NetConnection();
netConnection.ObjectEncoding = ObjectEncoding.AMF3;
netConnection.Connect("http://localhost:2896/WebSite/Gateway.aspx");
System.Console.WriteLine("*** Flash RPC ***");
netConnection.Call("ServiceLibrary.MyDataService.GetCustomers", new GetCustomersHandler(), new object[] { "415" });
System.Console.WriteLine("*** Flex RPC ***");
netConnection.Call("my-amf", "fluorine", "ServiceLibrary.MyDataService", "GetCustomers", new GetCustomersHandler(), new object[] { "415" });
...
//Our result handler object
public class GetCustomersHandler : IPendingServiceCallback
{
public void ResultReceived(IPendingServiceCall call)
{
object result = call.Result;
}
}
For more information, see the [FluorineFx InstallDir]\Samples\Misc\AMFCall sample application.