Sockets: Difference between revisions
Content deleted Content added
m omit template reason parameter |
Added Clojure implementation. |
||
Line 216: | Line 216: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|Clojure}}== |
|||
<lang clojure> |
|||
(import '[java.net Socket]) |
|||
... |
|||
(defn send-data [host msg] |
|||
(let [sock (Socket. host 256) |
|||
ostream (.getOutputStream sock) |
|||
msg-as-bytes (.getBytes msg)] |
|||
(.write ostream msg-as-bytes) |
|||
(.flush ostream) |
|||
(.close sock))) |
|||
(send-data "localhost" "Hello") |
|||
nil</lang> |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |