文件名称:.Net开源的高性能网络框架 Griffin.Framework.zip
文件大小:6.18MB
文件格式:FRAMEWORK
更新时间:2022-08-08 00:09:37
开源项目
Griffin.Framework 是 .NET 的高性能网络框架。示例代码:public class Server{ private readonly ChannelTcpListener _server; public Server() { _server = new ChannelTcpListener(); _server.MessageReceived = OnMessage; _server.ClientConnected = OnClientConnected; _server.ClientDisconnected = OnClientDisconnected; } public int LocalPort { get { return _server.LocalPort; } } public void Start() { _server.Start(IPAddress.Any, 0); } private void OnClientConnected(object sender, ClientConnectedEventArgs e) { Console.WriteLine("Got connection from client with ip " e.channel.RemoteEndPoint); } private void OnClientDisconnected(object sender, ClientDisconnectedEventArgs e) { Console.WriteLine("Disconnected: " e.Channel.RemoteEndpoint); } private void OnMessage(ITcpChannel channel, object message) { Console.WriteLine("Server received: " message); channel.Send(Encoding.ASCII.GetBytes("Hello world")); }} 标签:网络框架