code-examples/current/samples/julia/net.jl

16 lines
357 B
Julia

import Sockets as s;
scon = s.connect("www.google.com", 80)
write(scon, "GET / HTTP/1.1\r\n")
write(scon, "Host: www.google.com\r\n")
write(scon, "User-Agent: bot\r\n")
write(scon, "Connection: close\r\n")
write(scon, "\r\n")
bytes = read(scon)
response = String(bytes)
for line in split(response, "\r\n")
print("Response line " * line * "\r\n")
end