-
Notifications
You must be signed in to change notification settings - Fork 2
sys.net
TurtleKitty edited this page May 18, 2019
·
2 revisions
Your gateway to the Internet.
sys.net.tcp has methods listen and connect for dealing with TCP sockets.
sys.net.http has only one method at the moment: get.
(def server (sys.net.tcp.listen "localhost" 9000))
; (tcp-listener "localhost" 9000)
(def client (sys.net.tcp.connect "localhost" 9000))
; (socket "::1" 58820 -> "::1" 9000)
(def s-sock server.accept)
; (socket "::1" 9000 -> "::1" 58820)
(s-sock.say "Sup?") ; null
client.read-line ; "Sup?"
(sys.net.http.get "http://jsonip.com/")
; "{\"ip\":\"127.0.0.1\",\"about\":\"/about\",\"Pro!\":\"http://getjsonip.com\"}"