rupesh has asked for the wisdom of the Perl Monks concerning the following question:
And my server like this :$sockclient = new IO::Socket::INET (PeerAddr => $remote_host, PeerPort => $remote_port, Proto => 'tcp', ); die "Socket could not be created. Reason: $!\n" unless $sockclient +;
Could anybody suggest a reliable approach to this so that :foreach my $hostvar (@remote_host) { $sockserver = new IO::Socket::INET (LocalHost => $hostvar, LocalPort => $remote_port, Proto => 'tcp', Listen => 5, Reuse => 1 + ) or warn "Socket could not be created in $hostvar. Reason: $!" unless +$sockserver; } while ($new_sock = $sockserver->accept()) { while (defined ($buf = <$new_sock>)) { # do something with $buf, and ask confirmation, input #etc. from + the client and again come back ... in a loop. } } close ($sockserver); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sock-Server and Sock-Client
by AcidHawk (Vicar) on Apr 16, 2003 at 10:18 UTC | |
|
Re: Sock-Server and Sock-Client
by castaway (Parson) on Apr 16, 2003 at 11:36 UTC | |
by rupesh (Hermit) on Apr 16, 2003 at 12:55 UTC | |
by castaway (Parson) on Apr 17, 2003 at 06:48 UTC | |
by rupesh (Hermit) on Apr 17, 2003 at 07:53 UTC | |
by castaway (Parson) on Apr 17, 2003 at 10:58 UTC | |
|
Re: Sock-Server and Sock-Client
by rupesh (Hermit) on Apr 16, 2003 at 09:30 UTC |