/// <summary> /// Connects/reconnects to the server. /// </summary> private void Connect() { client = new TcpClient(host, port); NetworkStream stream = client.GetStream(); reader = new HttpReader(stream, this); writer = new HttpWriter(stream, this); Application.Logger.Log(Logging.LogLevel.Information, "debug", "connected to " + host + ":" + port); }
/// <summary> /// Processes the incoming connection. /// </summary> private void Process() { // get stream NetworkStream stream = client.GetStream(); // create reader/writer this.writer = new HttpWriter(stream, this); this.reader = new HttpReader(stream, this); // handle requests while (client.Connected) { Handle(); } }