Etienne Ledoux wrote:
> greetings,
> 
> I'm attempting a perl program that will listen on a port for a
> connection. when a connection is made some info will be transfered
> and the client will disconnect.
> 
> I've never done this before but seem to be making some progress with
> all the resources available on the net. I was just wondering. You can
> use 'Socket' or 'IO::Socket' to do almost the same thing, it seems.
> Which is the best or most preferred method to use ? I used 'Socket'
> and so far so good. But I was just wondering what is the difference
> and preferred way ? 

I would strongly recommend IO::Socket over Socket for a production
application; the former does a much better job of encapsulating the gory
details. (One simple example: it remembers to turn on autoflush for your
sockets, which is a common thing to overlook.)

You should also have a look at Net::Daemon which handles all the networking
stuff for you, allowing you to focus on what your program needs to do.

Another alternative is to run your program under inetd. Then you don't have
to fool with any networking stuff. STDIN/STDOUT are just connected to the
client.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to