From: ara.t.howard@... Date: 2006-02-02T02:25:12+09:00 Subject: Re: IO and non-strings On Thu, 2 Feb 2006 cremes.devlist@mac.com wrote: > > On Feb 1, 2006, at 10:31 AM, ara.t.howard@noaa.gov wrote: > >> On Thu, 2 Feb 2006, Mark Volkmann wrote: >> >>> On 2/1/06, Joel VanderWerf wrote: >>> [snip] >>> Will I have to first send a number to the server that indicates the number >>> of bytes I'm going to send next so it will know how many to read? >> >> that certainly makes it easier in some cases. be careful about the length >> of >> the lenght though; for instance, if you decide to send something like >> 'length:data' to the client then >> >> 42:foobar # length length == 2 >> 4242:foobar # length length == 4 >> >> might want the client to read chars, based on return value of select, into >> a >> re-sizeable buf until ':' is seen and then convert to int to do a read(n). > > If you want a general mechanism for doing this type of work between Ruby and > Other Languages, use NetStrings [1]. If it's Ruby to Ruby, drb is a great > choice. (Oh, there is also a Ruby NetStrings class [2] but I can't vouch for > its correctness.) > > cr > > [1] http://cr.yp.to/proto/netstrings.txt > [2] http://raa.ruby-lang.org/project/djb-netstrings/ thanks. i actually read that and used something very close to netstrings for my acgi package - but i'd forgotten where i read about it. now i remember! ;-) -a -- happiness is not something ready-made. it comes from your own actions. - h.h. the 14th dali lama