/// <summary> /// Open connection of a TCP client. /// </summary> public void Connect() { tcpClient.Connect(HOST, PORT); clientState = new ClientState(tcpClient.GetStream()); ApplicationLogger.LogMessage(LogMessageType.Info, $"Client {userName} was connected to the {HOST}:{PORT}."); }
/// <summary> /// Post writing work. /// </summary> /// <param name="result"></param> private static void WriteAysnc(IAsyncResult result) { ClientState clientState = result.AsyncState as ClientState; clientState?.NetworkStream.EndWrite(result); }