/// <summary> /// Constructor for the SimpleServer. Starts listening for client connections on the specified port /// </summary> /// <param name="port">Port to listen for connections on.</param> public SimpleServer(int port) { // Create a new server listening on the specified port. Use this object as a reacting object. // The clients will be able to invoke methods in this instance. _server = new PokingServer(port, this); _server.Start(); _server.ClientConnected += (sender, client) => { Console.WriteLine("A client connected"); }; }
private static void TestFormatter(OELibProtobufFormatter.OELibProtobufFormatter serverFormatter, OELibProtobufFormatter.OELibProtobufFormatter clientFormatter, string formatterName, int port, string MethodName) { var sro = new ReactingObject(); var go = new AutoResetEvent(false); var server = new PokingServer(port, sro, serverFormatter, null, false); server.Start(); server.ClientConnected += (s, e) => { //Console.WriteLine($"Client connected to the server, server formatter is {server.Formatter}."); go.Set(); //e.PingInterval = 10000000; e.MessageReceived += (se, me) => { //Console.WriteLine($"Server got message {me.ToString()}."); }; }; var cro = new ReactingObject(); var client = new PokingClientConnection(cro, clientFormatter, null, false) /*PingInterval = 1000000 */ }
public Server() { _server = new PokingServer(1024, this); _server.Start(); }