From: Axel Etzold Date: 2007-05-25T05:23:21+09:00 Subject: Re: sending data, no strings via socket Maybe "pack/unpack" http://www.rubycentral.com/book/ref_c_array.html#Array.pack can solve your problem ? Best regards, Axel -------- Original-Nachricht -------- Datum: Fri, 25 May 2007 05:02:49 +0900 Von: Javier None An: ruby-talk@ruby-lang.org Betreff: sending data, no strings via socket > I'm trying to send data like > > typedef struct{ > u_int32_t type; > u_int8_t len; > u_int8_t * buf; > } > > over a tcp socket using ruby. > > Anything I push over the socket comes out the other end as a string.. > > in Ruby.. > > data = 10 > socket = TCPSocket.new(home,port) > socket.write(data) > > on the other end I get > receieved byte dump > 0000: 31 30 10 > > which is the ascii for 10. How can I tell Ruby to send the 0x10? > even if I write > data = 0x10 > on the other side I get: > 0000: 31 36 16 > Which again, is the ascii getting send, not the data. > thanks for any help. > > -- > Posted via http://www.ruby-forum.com/. -- Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger