diff --git a/current/samples/julia/net.jl b/current/samples/julia/net.jl new file mode 100644 index 0000000..138dab4 --- /dev/null +++ b/current/samples/julia/net.jl @@ -0,0 +1,15 @@ +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