1 using System;
2 using System.Net.Sockets;
3 using System.IO;
4
5 int main()
6 {
7 try
8 {
9 TcpClient client("www.w3.org", "http");
10 SharedPtr<ByteStream> networkStream = client.GetStream();
11 StreamWriter writer(networkStream);
12 writer.Write("GET /2001/xml.xsd HTTP/1.1\r\nHost: www.w3.org\r\n\r\n");
13 StreamReader reader(networkStream);
14 string content = reader.ReadToEnd();
15 Console.WriteLine(content);
16 }
17 catch (const Exception& ex)
18 {
19 Console.Error() << ex.Message() << endl();
20 return 1;
21 }
22 return 0;
23 }