Skip to content

sys.net

TurtleKitty edited this page May 18, 2019 · 2 revisions

sys.net

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\"}"
Clone this wiki locally