Exemplo n.º 1
0
 public AsyncTcpServer(
     IPAddress listenedAddress, int listenedPort,
     Func <AsyncTcpServerSession, byte[], int, int, Task> onSessionDataReceived = null,
     Func <AsyncTcpServerSession, Task> onSessionStarted = null,
     Func <AsyncTcpServerSession, Task> onSessionClosed  = null,
     AsyncTcpServerConfiguration configuration           = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), onSessionDataReceived, onSessionStarted, onSessionClosed, configuration)
 {
 }
Exemplo n.º 2
0
 public AsyncTcpServer(
     IPEndPoint listenedEndPoint,
     Func <AsyncTcpServerSession, byte[], int, int, Task> onSessionDataReceived = null,
     Func <AsyncTcpServerSession, Task> onSessionStarted = null,
     Func <AsyncTcpServerSession, Task> onSessionClosed  = null,
     AsyncTcpServerConfiguration configuration           = null)
     : this(listenedEndPoint,
            new AsyncTcpServerEventDispatcher(onSessionDataReceived, onSessionStarted, onSessionClosed),
            configuration)
 {
 }
Exemplo n.º 3
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.");
            }
        }
Exemplo n.º 4
0
 public AsyncTcpServer(IPAddress listenedAddress, int listenedPort, IAsyncTcpServerEventDispatcher dispatcher, AsyncTcpServerConfiguration configuration = null)
     : this(new IPEndPoint(listenedAddress, listenedPort), dispatcher, configuration)
 {
 }
Exemplo n.º 5
0
 public AsyncTcpServer(int listenedPort, IAsyncTcpServerEventDispatcher dispatcher, AsyncTcpServerConfiguration configuration = null)
     : this(IPAddress.Any, listenedPort, dispatcher, configuration)
 {
 }