public void Connect() { Debug.WriteLine("Client: Connection " + Server.endPoint.Address.ToString() + " " + iPort); try { ShouldBeRunning = true; inputThread = new Thread(new ThreadStart(inputWorker)); inputThread.Start(); client = new TcpEventClient(); client.Connect(Server.endPoint); client.PacketReceived += new Helper.Handlers.PacketReceivedEH(PacketReceived); } catch (Exception ex) { Debug.WriteLine("Error..... " + ex.Message); } }
public bool Connect() { bool connected = false; Debug.WriteLine("Client: Connection " + Server.endPoint.Address.ToString() + " " + iPort); try { ShouldBeRunning = true; inputThread = new Thread(new ThreadStart(inputWorker)); inputThread.Start(); client = new TcpEventClient(); client.PacketReceived += new Handlers.PacketReceivedEH(client_PacketReceived); client.Disconnected += new Handlers.voidEH(client_Disconnected); connected = client.Connect(Server.endPoint); } catch (Exception ex) { Debug.WriteLine("Comm Client Error..... " + ex.Message); connected = false; } return(connected); }