Created
February 6, 2013 22:50
-
-
Save Scriptor/4726625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns stream-play) | |
(use pharen.io.async as io) | |
(let | |
[addr (gethostbyname "www.example.com") | |
client (stream_socket_client (. "tcp://" addr ":80") | |
errno error-msg 30 | |
(| STREAM_CLIENT_CONNECT STREAM_CLIENT_ASYNC_CONNECT)) | |
read (arr [client]) | |
write (arr [client]) | |
except NULL] | |
(prn (stream-select read write except 0)) | |
(stream-set-blocking client 0) | |
(fwrite client "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n") | |
(fclose client)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment