Exemple #1
0
        public AsyncTcpServer(IPEndPoint listenedEndPoint, IAsyncTcpServerEventDispatcher dispatcher, AsyncTcpServerConfiguration configuration = null)
        {
            if (listenedEndPoint == null)
            {
                throw new ArgumentNullException("listenedEndPoint");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            this.ListenedEndPoint = listenedEndPoint;
            _dispatcher           = dispatcher;
            _configuration        = configuration ?? new AsyncTcpServerConfiguration();

            if (_configuration.BufferManager == null)
            {
                throw new InvalidProgramException("The buffer manager in configuration cannot be null.");
            }
            if (_configuration.FrameBuilder == null)
            {
                throw new InvalidProgramException("The frame handler in configuration cannot be null.");
            }
        }
Exemple #2
0
 public AsyncTcpServer(IPAddress listenedAddress, int listenedPort, IAsyncTcpServerEventDispatcher dispatcher, AsyncTcpServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration)
 {
 }
Exemple #3
0
 public AsyncTcpServer(int listenedPort, IAsyncTcpServerEventDispatcher dispatcher, AsyncTcpServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, dispatcher, configuration)
 {
 }