-
Notifications
You must be signed in to change notification settings - Fork 12
Home
APM
High performance TCP communication framework,It is very simple to use
Server Example:
Console.Title = "Server";
Console.WriteLine("server test");
server = new Server(8889, 500);
server.OnAccepted += Server_OnAccepted;
server.OnMessage += Server_OnReceived;
server.OnDisConnected += Server_OnDisConnected;
server.OnOnError += Server_OnOnError;
server.Start();
Console.WriteLine("server is running...");
Client Example:
Console.WriteLine("Client send test");
var client = new Client(Guid.NewGuid().ToString("N"), 10, localIP);
client.OnConnected += Client_OnConnected;
client.OnMessage += Client_OnMessage;
client.OnDisConnected += Client_OnDisConnected;
client.OnError += Client_OnError;
client.Connect();
Server send message
server.SendMsg(remote, "server:hello " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
Server send file
server.SendFile(UserToken remote, string fileName);
Client send message
client.SendMsg("client:hello " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
Client send file
client.sendFile(string fileName);