I copied an example of how to use a socket and a stream to send a request to a server below. It was from Nicky and there is a reference to the link at the end of this post. How can I read the stream returned from the server in this example ? What type of conversion can I expect to have to make so the response is human readable ?
public static void InStateToServer(int port) { IPHostEntry host = Dns.GetHostEntry("192.168.2.231"); IPEndPoint endPoint = new IPEndPoint(host.AddressList[0], 80); using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { socket.Connect(endPoint); using (NetworkStream ns = new NetworkStream(socket)) { byte[] bytes = System.Text.Encoding.UTF8.GetBytes("GET /decoder_control.cgi?command=" + port + "&user=admin&pwd=abc HTTP/1.1\r\n"); ns.Write(bytes, 0, bytes.Length); } } }
Code From Nicky
http://forums.netdui...es-a-long-time/