Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            TestFormatter(null, null, ".Net BinaryFormatter", 1024, "Method1");
            Console.WriteLine("---------------------------------------------------------------------------");

            var serverFormatter = new OELibProtobufFormatter.OELibProtobufFormatter();
            var clientFormatter = new OELibProtobufFormatter.OELibProtobufFormatter();

            TestFormatter(serverFormatter, clientFormatter, "Manual Binary hybrid", 1025, "Method1");
            Console.WriteLine("---------------------------------------------------------------------------");

            TestFormatter2(serverFormatter, clientFormatter, "Manual Binary Protobuf hybrid", 1026, "Method2");

            Console.WriteLine("Press enter to exit.");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        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 */ }