将FluorineFx作为客户端,使用C#调用ASPX服务端Flash Remoting
2011-07-28 13:48
477 查看
请参照 \FluorineFx\Samples\Misc\AMFCall
我用的是老版本,Macromedia的FlashRemoting1.1 服务器组件.小巧,高性能.可能现在用的人很少很少了吧.呵呵.这个没关系
namespace AMFCall
{
class Program
{
NetConnection _netConnection;
static void Main(string[] args)
{
Program program = new Program();
program.Connect();
System.Console.ReadLine();
}
public void Connect()
{
// Create NetConnection client
_netConnection = new NetConnection();
_netConnection.ObjectEncoding = ObjectEncoding.AMF0;
_netConnection.NetStatus += new NetStatusHandler(_netConnection_NetStatus);
_netConnection.Connect("http://game.xxxxx.com/gateway.aspx");
System.Console.WriteLine("*** Flash RPC ***");
_netConnection.Call(".cc", new GetCustomersHandler(), new object[] { "/DDF", "1038", "00000000000000000000000000000000", "yuyu", "0" });
System.Console.WriteLine("Press 'Enter' to exit");
}
void _netConnection_NetStatus(object sender, NetStatusEventArgs e)
{
string level = e.Info["level"] as string;
if (level == "error")
{
//received an error
System.Console.WriteLine("Error: " + e.Info["code"] as string);
}
if (level == "status")
{
System.Console.WriteLine("Status: " + e.Info["code"] as string);
}
}
}
public class GetCustomersHandler : IPendingServiceCallback
{
public void ResultReceived(IPendingServiceCall call)
{
object result = call.Result;
Console.WriteLine(result.ToString());//<===这里直接打印出了服务器返回的字符串
}
}
}
我用的是老版本,Macromedia的FlashRemoting1.1 服务器组件.小巧,高性能.可能现在用的人很少很少了吧.呵呵.这个没关系
namespace AMFCall
{
class Program
{
NetConnection _netConnection;
static void Main(string[] args)
{
Program program = new Program();
program.Connect();
System.Console.ReadLine();
}
public void Connect()
{
// Create NetConnection client
_netConnection = new NetConnection();
_netConnection.ObjectEncoding = ObjectEncoding.AMF0;
_netConnection.NetStatus += new NetStatusHandler(_netConnection_NetStatus);
_netConnection.Connect("http://game.xxxxx.com/gateway.aspx");
System.Console.WriteLine("*** Flash RPC ***");
_netConnection.Call(".cc", new GetCustomersHandler(), new object[] { "/DDF", "1038", "00000000000000000000000000000000", "yuyu", "0" });
System.Console.WriteLine("Press 'Enter' to exit");
}
void _netConnection_NetStatus(object sender, NetStatusEventArgs e)
{
string level = e.Info["level"] as string;
if (level == "error")
{
//received an error
System.Console.WriteLine("Error: " + e.Info["code"] as string);
}
if (level == "status")
{
System.Console.WriteLine("Status: " + e.Info["code"] as string);
}
}
}
public class GetCustomersHandler : IPendingServiceCallback
{
public void ResultReceived(IPendingServiceCall call)
{
object result = call.Result;
Console.WriteLine(result.ToString());//<===这里直接打印出了服务器返回的字符串
}
}
}
相关文章推荐
- 基于Web Service的客户端框架搭建一:C#使用Http Post方式传递Json数据字符串调用Web Service
- Git服务搭建使用Linux作为服务端,window作为客户端
- 采用spring,maven,xfire/cxf 实现SOAP的WebService,并用C#作为客户端调用
- spring-boot 作为dubbo客户端 调用 dubbo 服务端 配置以及代码段
- webservice客户端(使用java代码调用服务端)
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- 使用AjaxMethod可以在客户端异步调用服务端方法
- 常量,字段,构造方法 调试 ms 源代码 一个C#二维码图片识别的Demo 近期ASP.NET问题汇总及对应的解决办法 c# chart控件柱状图,改变柱子宽度 使用C#创建Windows服务 C#服务端判断客户端socket是否已断开的方法 线程 线程池 Task .NET 单元测试的利剑——模拟框架Moq
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- 使用JQuery从客户端调用C#方法
- 服务端使用Axis2-1.6.3发布webservice服务、客户端使用Axis1.4实现调用
- 使用Ajax在客户端调用服务端函数并传值
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- 基于Web Service的客户端框架搭建一:C#使用Http Post方式传递Json数据字符串调用Web Service
- 使用socket实现简单的客户端和服务端通信(C#语言)
- asp.net中ajax使用(客户端调用服务端方法)
- RPC学习--C#使用Thrift简介,C#客户端和Java服务端相互交互
- C#前台js里面使用ajax调用后台aspx.cs方法