There was an error while loading. Please reload this page.
This TcpSocket example simulates a HTTP 1.1 request against a valid IP address on the Internet, showing the HTML source of the page.
TcpSocket
import std.io; import std.net; Int i = 8; String page; TcpSocket s = TcpSocket(); s.setHost("200.132.43.5"); s.setPort(80); s.connect(); s.send("GET / HTTP/1.1\n"); s.send("Host: 200.132.43.5\n"); s.send("\n"); while (i > 0) { page = s.receive(); print(page); if (!s.poll()) { i--; } } println("-- Finished. --");