Пример #1
0
 public override void Start(SocketServerSettings settings)
 {
     base.Start(settings);
     this._bufferManager = new BufferManager(this.Settings.BufferSize * this.Settings.NumberOfSaeaForReceiveSend * this.Settings.OpsToPreAllocate,
     this.Settings.BufferSize * this.Settings.OpsToPreAllocate);
     this._poolOfAcceptEventArgs = new SocketAsyncEventArgsPool(this.Settings.MaxAcceptOps);
     this._poolOfReceiveSendEventArgs = new SocketAsyncEventArgsPool(this.Settings.NumberOfSaeaForReceiveSend);
     Init();
     StartListen();
     Log(string.Format("Server started on {0}:{1}", settings.LocalEndPoint.Address, settings.LocalEndPoint.Port));
 }
Пример #2
0
        public virtual void Start(SocketServerSettings settings)
        {
            if (settings == null)
            {
                throw new ServerException("Server settings can't be null!");
            }

            this.Settings = settings;
            this.ServerType = this.Settings.ServerType;
            RequestHandler = SocketRequestHandler.CreateRequestHandler(this);
            this.TheMaxConnectionsEnforcer = new Semaphore(this.Settings.MaxConnections, this.Settings.MaxConnections);

            ServerStarted(new ClientAction(){ActionType = ServerEventTypes.ServerStarted});
        }