From: Gary Wright Date: 2009-07-21T23:41:41+09:00 Subject: Re: Another TCPSocket Question On Jul 21, 2009, at 10:31 AM, Greg Chambers wrote: >> Gary Wright > > Okay, not too bad. Wait, if I send the fixnum ahead of time, is the > number of bytes I need to receive dependent on how long the message is > still? Or is there a way to send an integer always using 4 bytes or > something like that? Look at Array#pack and String#unpack if you want to send binary numeric values (i.e., 8-bit or 32-bit integers). I'd recommend going the text/newline approach if at all possible, otherwise you are dealing with a binary protocol which can be more difficult to work with. Even better would be to used a pre-existing protocol instead of re-inventing the wheel. I'd have to know more about your situation though to recommend anything in particular. Gary Wright