I did look at Gloss before writing Marshal and decided against using it in our application suite, I wanted something more focused utilizing InputStream/OutputStream interface and able to handle variable sized arrays/strings (size of array or string specified in packet).
On Sun, Feb 5, 2012 at 6:10 PM, Alan Malloy <a...@malloys.org> wrote: > Zack Tellman's library Gloss is excellent for this, if a bit confusing > to understand at first. > > On Feb 5, 2:50 pm, russellc <russell.christop...@gmail.com> wrote: > > I needed a library to handle marshaling application defined (C > > struct) binary TCP/IP protocol packets in a Clojure client app > > replacing a legacy C++ client and there didn't seem to be an existing > > library that performed as I needed. So, I've written a Marshal library > > that marshals from the network to/from Clojure. > > > > Github:http://github.com/russellc/Marshal > > Clojars:https://clojars.org/marshal > > > > //C header file definition > > struct packet { > > unsigned long type; > > unsigned long size; > > long data[1]; > > > > }; > > > > (require '[marshal.core :as m]) > > (def packet (m/struct :type m/uint32 :size m/uint32 :data (m/array m/ > > sint32 :size))) > > (m/write output-stream packet {:type 1 :size 2 :data [1 -1]}) > > (m/read input-stream packet) > > => {:type 1 :size 2 :data [1 -1]} > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en