On May 21, 2011, at 3:46 AM, Guyren Howe wrote:
I’d like to write a simple custom protol handler in ruby.
Mac only would be okay, Safari only if need be, but cross platform
would be a bit better.
I can’t find a simple summary of how to do this anywhere.
Before I start trying to wade through specification documents and
bore myself senseless, any thoughts?
What kind of protocol?
"I want to write a protocol" is like saying "I want to write a program."
I've written a few truly custom protocols over HTTP, and it's as
simple as writing web pages.
If you're talking about accepting raw TCP packets into a custom port,
then you probably want to start with EventMachine.
I started to work on a Telnet Emulator a week ago, then it turned out
I didn't need to, but in the meantime I got my toes wet.
https://github.com/eventmachine/eventmachine/wiki
Be aware that your handler will not be anywhere near as simple as the
Echo examples. You'll have to buffer the incoming data and parse it
until there's a complete recognizable command. So after you play with
the Echo examples, the next task is to seek out some examples with
input buffering and see how that all works. That's about where I
bailed, so I didn't get that far.
-- gw
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby