一个极其高效的C#的WebSocket服务器:Alchemy Websockets

jopen 11年前

Alchemy WebSockets 是一个 c# 的 WebSocket 开发包,可开发 WebSocket 的客户端和服务器端应用。

示例代码:

//...refs  using Alchemy;  using Alchemy.Classes;    static void Main(string[] args)  {    // instantiate a new server - acceptable port and IP range,    // and set up your methods.      var aServer = new WebSocketServer(81, IPAddress.Any) {      OnReceive = OnReceive,      OnSend = OnSend,      OnConnect = OnConnect,      OnConnected = OnConnected,      OnDisconnect = OnDisconnect,      TimeOut = new TimeSpan(0, 5, 0)    };      aServer.Start();  }    static void OnConnected(UserContext context)  {    Console.WriteLine("Client Connection From : " +    aContext.ClientAddress.ToString());  }    //...etc        

项目主页:http://www.open-open.com/lib/view/home/1393492178130