[Shootout-list] Ruby TCP submissions

Hunter Kelly retnuh at gmail.com
Sun Apr 23 22:54:51 UTC 2006


Here are some entries for the tcp-* programs, implemented in ruby.

The wording of the problem was slightly vague:  It doesn't say
what the request size is, nor what should be in it.

I noticed that even though the program is called tcp-echo, none
of the provided programs actually write back the content that was
is sent - they just sends back a fixed response to a 64 byte packet.

I had originally written the programs to send back the data that was 
sent, but seeing as how the other programs aren't doing that, I decided
not to, either.

If this is an error, please let me know.

Also, the tcp-echo program is very slightly different from the other two
because of how ruby's read method reads into an existing buffer.  I have 
non-buffering versions, which are slightly slower (becuase of memory 
allocation I suspect), but, in my opinion, much more "Ruby-like" and cleaner.
I'd be willing to post those if people think it's appropriate.

Thanks,

Hunter Kelly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcp-echo.rb
Type: application/x-ruby
Size: 918 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/shootout-list/attachments/20060423/18061ab3/tcp-echo.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcp-request-reply.rb
Type: application/x-ruby
Size: 939 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/shootout-list/attachments/20060423/18061ab3/tcp-request-reply.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcp-stream.rb
Type: application/x-ruby
Size: 939 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/shootout-list/attachments/20060423/18061ab3/tcp-stream.bin


More information about the Shootout-list mailing list