Esempio n. 1
0
        public void Start(int port)
        {
            var registry = new ExtensionRegistry();

            registry.AddOptionalExtension(new AckExtension()
            {
                MessagesPerAck = MessagesPerAck,
                AckExpireTime  = TimeSpan.FromSeconds(1)
            });
            registry.AddOptionalExtension(new AckExtension());
            registry.AddOptionalExtension(new DotNetTypeExtension());
            registry.AddOptionalExtension(new FastJsonExtension());
            _server = new SharpMessagingServer(registry);
            _server.FrameReceived      = OnTimeSync;
            _server.ClientDisconnected = OnClientDisconnect;
            _server.Start(port);
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            var registry = new ExtensionRegistry();

            registry.AddOptionalExtension(new BatchAckExtension()
            {
                MessagesPerAck = 200,
                AckExpireTime  = TimeSpan.FromSeconds(1)
            });
            registry.AddOptionalExtension(new SingleAckExtension());
            registry.AddOptionalExtension(new DotNetTypeExtension());
            registry.AddOptionalExtension(new FastJsonExtension());
            var server = new SharpMessagingServer(registry);

            server.FrameReceived = OnFrame;
            server.Start(8334);

            Console.ReadLine();
        }