public ChoTcpClient(IPEndPoint localEP, ChoTcpServiceProvider provider = null, IChoObjectSerializer serializer = null) { _localEP = localEP; _provider = provider == null ? ChoTcpServiceProviderImpl.Instance : provider; ReconnectInterval = 5000; _pollTimer = new Timer(OnSocketDropPoll, null, ReconnectInterval, ReconnectInterval); if (serializer != null) { Serializer = serializer; } }
/// <SUMMARY> /// Initializes server. To start accepting /// connections call Start method. /// </SUMMARY> public ChoTcpServer(int port, ChoTcpServiceProvider provider = null, IChoObjectSerializer serializer = null) { _provider = provider == null ? ChoTcpServiceProviderImpl.Instance : provider; _port = port; _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _connections = new List <ChoConnectionState>(); ConnectionReady = new AsyncCallback(ConnectionReady_Handler); AcceptConnection = new WaitCallback(AcceptConnection_Handler); ReceivedDataReady = new AsyncCallback(ReceivedDataReady_Handler); if (serializer != null) { Serializer = serializer; } }
public ChoTcpClient(string hostname, int port, ChoTcpServiceProvider provider = null, IChoObjectSerializer serializer = null) : this(new IPEndPoint(IPAddress.Parse(hostname), port), provider, serializer) { }