// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Net.Sockets; using System.IO; class MainClass { public static void Main(string[] args) { TcpClient client = new TcpClient("www.microsoft.com", 80); StreamWriter wrt = new StreamWriter(client.GetStream()); StreamReader rdr = new StreamReader(client.GetStream()); wrt.WriteLine("GET / HTTP/1.1"); wrt.WriteLine("Host: www.microsoft.com"); wrt.WriteLine("Connection: close"); wrt.WriteLine(""); wrt.Flush(); string line; while((line = rdr.ReadLine()) != null) { Console.WriteLine(line); } wrt.Close(); rdr.Close(); client.Close(); } }