Ruby TCP submissions

View: New views
1 Messages — Rating Filter:   Alert me  

Ruby TCP submissions

by Hunter Kelly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




_______________________________________________
Shootout-list mailing list
Shootout-list@...
http://lists.alioth.debian.org/mailman/listinfo/shootout-list

tcp-echo.rb (970 bytes) Download Attachment
tcp-request-reply.rb (992 bytes) Download Attachment
tcp-stream.rb (992 bytes) Download Attachment
LightInTheBox - Buy quality products at wholesale price