= Super simple Socket example = This example uses HTTP 1.1 to retrieve a web page. Code, and then wireshark it to see what the network traffic it generates looks like. {{{#!csharp //Libraries used using System.Net.Sockets; using System.Text; //Request Information string IP = "128.119.245.12"; string request = "GET /wireshark-labs/INTRO-wireshark-file1.html\r\n" + "Host: gaia.cs.umass.edu\r\n\r\n"; //Sending the Request TcpClient socket = new TcpClient(); socket.Connect(IP, 80); NetworkStream stream = socket.GetStream(); stream.Write(ASCIIEncoding.ASCII.GetBytes(request)); //Reading the response StringBuilder sb = new StringBuilder(); byte[] buffer = new byte[65536]; stream.ReadTimeout = 15000; //15 seconds try { do { stream.Read(buffer, 0, buffer.Length); sb.Append(ASCIIEncoding.ASCII.GetString(buffer)); } while (stream.DataAvailable); } catch (Exception ex) { sb.Append(ex.Message); } Console.WriteLine(sb.ToString()); }}}