public Connection(Socket inSock, delVoidConnectionString DisconnectFunc, delVoidString ErrorFunc, delVoidLineSegment OutputLine) { connection = inSock; address = connection.RemoteEndPoint; Disconnect = DisconnectFunc; ErrorOccurred = ErrorFunc; OutputLineSeg = OutputLine; Thread thread = new Thread(ThreadReading); thread.IsBackground = true; thread.Start(); thread = new Thread(ProcessThread); thread.IsBackground = true; thread.Start(); }
public Connection(string Address, int Port, delVoidConnectionString DisconnectFunc, delVoidString ErrorFunc, delVoidLineSegment OutputLine) { try { connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } catch (Exception err) { ErrorOccurred(err.Message); return; } Disconnect = DisconnectFunc; ErrorOccurred = ErrorFunc; OutputLineSeg = OutputLine; EstablishConnection(Address, Port); }