Julia simple raw HTTP/1.1 connection as client.
This commit is contained in:
parent
37a2d5c5f4
commit
e9f413ef67
1 changed files with 15 additions and 0 deletions
15
current/samples/julia/net.jl
Normal file
15
current/samples/julia/net.jl
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue