I'm trying to create a simple TCP client. The user enters the host, port, and a send statement(GET, HEAD, etc).
Then the Headers and everything else is returned back in a textbox. When I send the information, it pauses for a second, then it just does the crlf.
sentText is where I entered my send statement. textOutput is where everything is to be displayed.
connectSocket.Connect(host, port);
System.IO.StreamReader connectionRead
= new System.IO.StreamReader(new NetworkStream(connectSocket));
//sendString(connectSocket, sendText);
connectSocket.Send(System.Text.Encoding.UTF8.GetBytes(sendText.Text));
this.textOutput.AppendText(connectionRead.ReadLine() + "\r\n");
I have also tried
connectSocket.Send(System.Text.Encoding.UTF8.GetBytes(sendText.Text));
while (connectionRead.Peek() > 0)
{
this.textOutput.AppendText(connectionRead.ReadLine() + "\r\n");
}
connectSocket.Close();
I'm not really sure what that does, but I don't even the the crlf with that.