Example #1
0
 /// <SUMMARY>
 /// Initializes server. To start accepting connections call Start method.
 /// </SUMMARY>
 public TcpServer(TcpServiceProvider provider, int port)
 {
     m_provider        = provider;
     m_port            = port;
     m_listener        = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     m_connections     = new ArrayList();
     ConnectionReady   = new AsyncCallback(ConnectionReady_Handler);
     AcceptConnection  = new WaitCallback(AcceptConnection_Handler);
     ReceivedDataReady = new AsyncCallback(ReceivedDataReady_Handler);
 }
Example #2
0
 public TcpServer(TcpServiceProvider provider, string bindip, int port, bool isssl)
 {
     this.maxCurrentConnections = 0;
     this._provider             = provider;
     this._port             = port;
     this.bindip            = bindip;
     this.isssl             = isssl;
     this._listener         = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this._connections      = new ArrayList();
     this.ConnectionReady   = new AsyncCallback(this.ConnectionReady_Handler);
     this.AcceptConnection  = new WaitCallback(this.AcceptConnection_Handler);
     this.ReceivedDataReady = new AsyncCallback(this.ReceivedDataReady_Handler);
 }
Example #3
0
 /// <SUMMARY>
 /// Initializes server. To start accepting connections call Start method.
 /// </SUMMARY>
 public TcpServer(TcpServiceProvider provider, String ip, int port)
 {
     _provider = provider;
     _port     = port;
     if (0 != ip.Length)
     {
         _ip = IPAddress.Parse(ip);
     }
     else
     {
         IPAddress ipAddress = getIp4Address(Dns.GetHostName());// Dns.GetHostEntry(Dns.GetHostName()).AddressList[0];
         _ip = ipAddress;
     }
     _listener = new Socket(_ip.AddressFamily /*AddressFamily.InterNetwork*/, SocketType.Stream,
                            ProtocolType.Tcp);
     _connections      = new ArrayList();
     ConnectionReady   = new AsyncCallback(ConnectionReady_Handler);
     AcceptConnection  = new WaitCallback(AcceptConnection_Handler);
     ReceivedDataReady = new AsyncCallback(ReceivedDataReady_Handler);
 }
Example #4
0
 /// <SUMMARY>
 /// Initializes server. To start accepting connections call Start method.
 /// </SUMMARY>
 public TcpServer(TcpServiceProvider provider, int port)
 {
     _provider = provider;
     _port = port;
     _listener = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
         ProtocolType.Tcp);
     _connections = new ArrayList ();
     ConnectionReady = new AsyncCallback (ConnectionReady_Handler);
     AcceptConnection = new WaitCallback (AcceptConnection_Handler);
     ReceivedDataReady = new AsyncCallback (ReceivedDataReady_Handler);
 }
Example #5
0
 public TcpServer(int port, TcpServiceProvider serviceProvider)
 {
     this.port            = port;
     this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
 }