Skip to content

Instantly share code, notes, and snippets.

@zhuzhonghua
Created January 25, 2019 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuzhonghua/d9e5ddafaeec2fd6bc6f2709a835d0ca to your computer and use it in GitHub Desktop.
Save zhuzhonghua/d9e5ddafaeec2fd6bc6f2709a835d0ca to your computer and use it in GitHub Desktop.
clojure socket client send int bytebuffer
(ns ssrvclj.testclient
(:import [java.net Socket]
[java.nio ByteBuffer]))
(def buf (ByteBuffer/allocate 4));
(.putInt buf 100)
(def byte-buf (.array buf))
(def sock (Socket. "127.0.0.1" 8888))
(-> sock
.getOutputStream
(.write (.array buf)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment