-
-
Save tomjack/5f59ff4e091bc015a8a6 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
(defmacro with-socket [[in-stream-var out-stream-var] {:keys [host port]} & body] | |
`(let [sock# (java.net.Socket. ~host ~port) | |
~in-stream-var (.getInputStream sock#) | |
~out-stream-var (.getOutputStream sock#)] | |
(try ~@body | |
(finally (.close sock#))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment