We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The title says it all. Here is the server and client code.
Server code:
using System; using System.Text; using Telepathy; namespace TelepathyTestServer { class Program { static void Main(string[] args) { const int MaxMessageSize = 8 * 1024; Encoding utf8 = Encoding.UTF8; Server server = new Server(MaxMessageSize); server.OnConnected = (connectionId) => { Console.WriteLine("Client [{0}] connected.", connectionId); byte[] msg = utf8.GetBytes("Hello from server."); server.Send(connectionId, new ArraySegment<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:
using System; using System.Text; using Telepathy; namespace ClientTest { class Program { static void Main(string[] args) { const int MaxMessageSize = 8 * 1024; Encoding utf8 = Encoding.UTF8; Client client = new Client(MaxMessageSize); client.OnConnected = () => { Console.WriteLine("Connected to server."); byte[] msg = utf8.GetBytes("Hello from client."); client.Send(new ArraySegment<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:
Hi,
This is due to ReceiveTimeout in Common.cs -> set it to 0 or use a periodic heartbeat system.
Sorry, something went wrong.
Ok thanks. Great feature BTW!
No branches or pull requests
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: