You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The title says it all. Here is the server and client code.
Server code:
usingSystem;usingSystem.Text;usingTelepathy;namespaceTelepathyTestServer{classProgram{staticvoidMain(string[]args){constintMaxMessageSize=8*1024;Encodingutf8=Encoding.UTF8;Serverserver=newServer(MaxMessageSize);server.OnConnected=(connectionId)=>{Console.WriteLine("Client [{0}] connected.",connectionId);byte[]msg=utf8.GetBytes("Hello from server.");server.Send(connectionId,newArraySegment<byte>(msg));};server.OnData=(connectionId,data)=>{Console.WriteLine(connectionId+" Data: "+utf8.GetString(data.Array,0,data.Count));};server.OnDisconnected=(connectionId)=>Console.WriteLine("Client [{0}] disconnected.",connectionId);server.Start(5200);while(true){server.Tick(100);System.Threading.Thread.Sleep(1);}}}}
Client code:
usingSystem;usingSystem.Text;usingTelepathy;namespaceClientTest{classProgram{staticvoidMain(string[]args){constintMaxMessageSize=8*1024;Encodingutf8=Encoding.UTF8;Clientclient=newClient(MaxMessageSize);client.OnConnected=()=>{Console.WriteLine("Connected to server.");byte[]msg=utf8.GetBytes("Hello from client.");client.Send(newArraySegment<byte>(msg));};client.OnData=(data)=>Console.WriteLine(utf8.GetString(data.Array,0,data.Count));client.OnDisconnected=()=>Console.WriteLine("Disconnected from server.");client.Connect("127.0.0.1",5200);System.Threading.Thread.Sleep(100);while(true){client.Tick(100);System.Threading.Thread.Sleep(1);}}}}```
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
The title says it all. Here is the server and client code.
Server code:
Client code:
The text was updated successfully, but these errors were encountered: