Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Best module to implement smtp-like protocol over sockets?

by Anonymous Monk
on Sep 03, 2007 at 01:40 UTC ( #636657=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, fellow scholastic writers of tomes!

I am writing a testing utility for a hobby hack.

Basically, I want a server which communicates with multiple clients using a line-oriented protocol. The server receives a text command from a client and sends text answers back to multiple clients.

What CPAN modules are the recommended ways these days to handle line-oriented non-blocking socket comm?

Should I look at POE or just browse the source for e.g. some smtp or chat implementations?

Comment on Best module to implement smtp-like protocol over sockets?
Re: Best module to implement smtp-like protocol over sockets?
by Your Mother (Canon) on Sep 03, 2007 at 03:07 UTC

    POE is great and its docs are getting better; sorry I can't point you to a specific sub-class. Also consider picking up a copy of Stein's Network Programming with Perl (I think he put all the code from the book online somewhere). You'll learn more about the guts that way. I was able to write a daemon chat server in a couple of days after picking it up.

      Thanks, I browsed that book at a friend's place once and it seems nice.

      It is just such a problem-in-a-box that there should be multiple good solutions at CPAN.

      I checked relevant packages on Debian (my usual way to find popular non-webprogramming Perl modules not on perladvent). Danga::Socket looks good.

      Also consider picking up a copy of Stein's Network Programming with Perl (I think he put all the code from the book online somewhere).
      He sure did: "Network Programming with Perl" resources.

      And I wholeheartedly agree with your recommendation: I think this is one of the best books available on network programming, in any language.

Re: Best module to implement smtp-like protocol over sockets?
by sgt (Chaplain) on Sep 03, 2007 at 12:50 UTC

    line-oriented non-blocking sockets:

  • IO::SessionData (part of SOAP::Lite -- don't ask me why!)
  • IO::LineBufferedSessionData

    cheers --stephan
Re: Best module to implement smtp-like protocol over sockets?
by valdez (Monsignor) on Sep 03, 2007 at 14:37 UTC

    Ciao,

    I would start from Net::Server, in particular the samplechat.pl example; this module is a real coding pleasure ;). In case you are really interested in talking SMTP, try with Net::Server::Mail. These are two distinct distributions that play really well together.

    HTH, Valerio

Re: Best module to implement smtp-like protocol over sockets?
by former33t (Scribe) on Sep 04, 2007 at 14:09 UTC
    If your needs are simple, POE::Component::Server::TCP should do exactly what you want. Check out the following URL for a working example.

    http://poe.perl.org/?POE_Cookbook/Chat_Server

    I've had great success with POE::Component::Server::TCP in my applications.

Re: Best module to implement smtp-like protocol over sockets?
by BerntB (Deacon) on Sep 05, 2007 at 21:20 UTC

    I had to go find my password so I could vote up the answers to my question. :-)

    Thanks for the information, guys. I was quite certain there would exist neat modules, but some of those APIs are just beautiful in design and use. (I also thought POE would be complex but it was really neat.)

    (Fixed grammar, as always. Sigh.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://636657]
Approved by randyk
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2014-12-18 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (49 votes), past polls