Hello Brian,
 
Thank you very much for your example and time. Although i gotta say i felt your answer a little agressive since i really try not to email anyone before reading as much documentation as i can, but sometimes (like everybody else) i need some help through some things or to find the path. However, not complaining, just letting you know that i'm in fact RTFM. ;-)
 
Again, thanks a lot for your answer. It really helped.
 
Cheers,
 
Paco.
 
 
----- Original Message -----
Sent: Monday, September 18, 2006 3:46 AM
Subject: RE: Good IO::Socket::INET examples

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paco
Zarabozo A.
Sent: 16 September 2006 16:11
To: $Bill Luebkert
Cc: [EMAIL PROTECTED];
[email protected]
Subject: Re: Good IO::Socket::INET examples

> Thank very much for you good answer Bill, i'm on it.

Indeed.


> Do you know where i can view an example code showing all this? (or do
anyone else reading this message know?)

Well the example in 'perldoc IO::Select' seems to provide a basic
skeleton that can be fleshed out. However, as I am feeling generous
today for some reason, as well as suggesting that you RTFM, I have
fleshed it out a little.

----------------------------------------------------
use strict;
use warnings;
use IO::Select;
use IO::Socket;
my $lsn = new IO::Socket::INET(Listen => 1, LocalPort => 9876, ReuseAddr
=> 1);
my $sel = new IO::Select( $lsn );
while (my @ready = $sel->can_read) {
    foreach my $fh (@ready) {
if ($fh == $lsn) {
    my $new = $lsn->accept;
    $sel->add($new);
    my $host = $new->peerhost;
    print "[Accepting connection from $host]\n";
} else {
    my $line = <$fh>;
    $line =~ s/\s+$//;
    if ($line =~ /^quit/i) {
my $host = $fh->peerhost;
$sel->remove($fh);
$fh->close;
print "Connection from $host terminated\n";
    }
    else {
print $fh->peerhost, " said '$line'\n";
print $fh "You said: '$line'\n";
    }
}
    }
}
----------------------------------------------------

HTH

--
Brian Raven



=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to