static void Main(string[] args) { TcpClient clientSocket = new TcpClient("127.0.0.1", 6321); IClient cl = new Client(clientSocket); cl.OnReceiveMessageEvent += ReceiveMessage; string inPutString = "empty"; while (!inPutString.Contains("exit")) { inPutString = Console.ReadLine(); cl.SendMessage(cl.Name + ": " + inPutString); } cl.CloseConnection(); }