...

View Full Version : Socket Help



ACS - Nick
08-05-2009, 02:03 PM
Hi,
I have a bit of a tough one for me.
I have a server which I give a word to (say 'Chanel1').
It responds with whether the chanel is currently siezed and some other stats.
Depending on this responce I need to fire off a script.
There are some limits like the amount of times you can check for the chanel to be free (5 checks per second total).
Other things I would like to implement is some kind of restart script so if it dies before it gets the chanel free it will restart the checking. And logging if possible.
Another part is sometimes I need to check multiple chanels and as each one becomes available run the script on it.

I think I need to use Sockets to achieve this?
What Im after is any good reading on this and other bits of the puzzle I would need? Im not looking for someone to write the code.
I do have experiance in PHP butI am new to Perl so any help on where to look/start would be great.

FishMonger
08-05-2009, 02:25 PM
The best resource book that I know of for this type of task is "Network Programming with Perl" by Lincoln D. Stein
http://www.amazon.com/Network-Programming-Perl-Lincoln-Stein/dp/0201615711

You'll also want to read the docs for the Socket and IO::Socket modules.
http://search.cpan.org/~nwclark/perl-5.8.9/ext/Socket/Socket.pm
http://search.cpan.org/~gbarr/IO-1.25/lib/IO/Socket.pm

For the logging requirment, I'd use Log::Log4perl
http://search.cpan.org/~mschilli/Log-Log4perl-1.24/lib/Log/Log4perl.pm



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum