Exemple #1
0
        public AsyncTcpSocketClient(IPEndPoint remoteEP, IPEndPoint localEP, IAsyncTcpSocketClientEventDispatcher dispatcher, AsyncTcpSocketClientConfiguration configuration = null)
        {
            if (remoteEP == null)
            {
                throw new ArgumentNullException("remoteEP");
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            _remoteEndPoint = remoteEP;
            _localEndPoint  = localEP;
            _dispatcher     = dispatcher;
            _configuration  = configuration ?? new AsyncTcpSocketClientConfiguration();

            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 AsyncTcpSocketClient(IPAddress remoteAddress, int remotePort, IPEndPoint localEP,
                             Func <AsyncTcpSocketClient, byte[], int, int, Task> onServerDataReceived = null,
                             Func <AsyncTcpSocketClient, Task> onServerConnected    = null,
                             Func <AsyncTcpSocketClient, Task> onServerDisconnected = null,
                             AsyncTcpSocketClientConfiguration configuration        = null)
     : this(new IPEndPoint(remoteAddress, remotePort), localEP,
            onServerDataReceived, onServerConnected, onServerDisconnected, configuration)
 {
 }
Exemple #3
0
 public AsyncTcpSocketClient(IPEndPoint remoteEP,
                             Func <AsyncTcpSocketClient, byte[], int, int, Task> onServerDataReceived = null,
                             Func <AsyncTcpSocketClient, Task> onServerConnected    = null,
                             Func <AsyncTcpSocketClient, Task> onServerDisconnected = null,
                             AsyncTcpSocketClientConfiguration configuration        = null)
     : this(remoteEP, null,
            onServerDataReceived, onServerConnected, onServerDisconnected, configuration)
 {
 }
Exemple #4
0
 public AsyncTcpSocketClient(IPEndPoint remoteEP, IPEndPoint localEP,
                             Func <AsyncTcpSocketClient, byte[], int, int, Task> onServerDataReceived = null,
                             Func <AsyncTcpSocketClient, Task> onServerConnected    = null,
                             Func <AsyncTcpSocketClient, Task> onServerDisconnected = null,
                             AsyncTcpSocketClientConfiguration configuration        = null)
     : this(remoteEP, localEP,
            new DefaultAsyncTcpSocketClientEventDispatcher(onServerDataReceived, onServerConnected, onServerDisconnected),
            configuration)
 {
 }
Exemple #5
0
 public AsyncTcpSocketClient(IPEndPoint remoteEP, IAsyncTcpSocketClientEventDispatcher dispatcher, AsyncTcpSocketClientConfiguration configuration = null)
     : this(remoteEP, null, dispatcher, configuration)
 {
 }
Exemple #6
0
 public AsyncTcpSocketClient(IPAddress remoteAddress, int remotePort, IAsyncTcpSocketClientEventDispatcher dispatcher, AsyncTcpSocketClientConfiguration configuration = null)
     : this(new IPEndPoint(remoteAddress, remotePort), dispatcher, configuration)
 {
 }