From: Bill Kelly Date: 2003-03-31T03:08:49+09:00 Subject: Re: writing a 4 byte Integer to socket Hi, From: "gabriele renzi" > > I need to write a value (it should be a Fixnum, but I'm not sure) over > a TCPSocket. > How can I write it in a typical "4 bytes, network byte order" style? > > And what if I need to compose a byte and send it over the network? > Is BitVector the only choice? Array#pack is probably what you're looking for... http://www.rubycentral.com/ref/ref_c_array.html#pack (the table showing the template characters for pack is a few pages up in that document... search for "Template characters for Array#pack") Hope this helps, Bill