public Client(TcpClient client, IEventDispatcher eventDispatcher, Parser.ParserMethod parseMethod, ClientConnectedHandler onConnect = null) { _client = client; Connected = true; _client.NoDelay = true; _eventDispatcher = eventDispatcher; _parseMethod = parseMethod; _networkInfos = _client.Client.RemoteEndPoint.ToString(); if (onConnect != null) onConnect.BeginInvoke(this, null, null); new Task(Receive).Start(); }
public Client(string ip, int port, IEventDispatcher eventDispatcher, Parser.ParserMethod parseMethod, ClientConnectedHandler onConnect = null) { try { _client = new TcpClient(ip, port); Connected = true; _client.NoDelay = true; _eventDispatcher = eventDispatcher; _parseMethod = parseMethod; _networkInfos = _client.Client.RemoteEndPoint.ToString(); if (onConnect != null) onConnect.BeginInvoke(this, null, null); new Task(Receive).Start(); } catch (SocketException se) { Connected = false; } }
public Server(IEventDispatcher eventDispatcher, Parser.ParserMethod parseMethod) { _eventDispatcher = eventDispatcher; _parserMethod = parseMethod; }