Exemple #1
0
        public NetServer(INetServerOptions options = null)
        {
            this.Options       = options ?? NetServerOptions.Create();
            this.SocketArgPool = new SocketEventArgPool(this.Options.MaxConnections);
            this.BufferPool    = new BufferPool(this.Options.BufferSize, this.Options.MaxConnections);

            this.OnListen  = delegate { };
            this.OnConnect = delegate { };
            this.OnFault   = delegate { };
        }
 public static NetServerOptions Create()
 {
     // Set defaults;
     var result = new NetServerOptions();
     result.IPv4Only = true;
     result.MaxAccept = 100; // The size of the queue of incoming connections for the listen socket.
     result.MaxConnections = 10000;
     result.BufferSize = 1024;
     result.ReceivePrefixLength = 4; // is the length of 32 bit integer
     result.SendPrefixLength = 4; // is the length of 32 bit integer
     return result;
 }
        public static NetServerOptions Create()
        {
            // Set defaults;
            var result = new NetServerOptions();

            result.IPv4Only            = true;
            result.MaxAccept           = 100; // The size of the queue of incoming connections for the listen socket.
            result.MaxConnections      = 10000;
            result.BufferSize          = 1024;
            result.ReceivePrefixLength = 4; // is the length of 32 bit integer
            result.SendPrefixLength    = 4; // is the length of 32 bit integer
            return(result);
        }