S
sgt_b2002
Writing a small server where I want the server to stop accepting new
connections after the inital client connects. I'm creating the socket
as such:
$sock = new IO::Socket::INET(
LocalHost => $cip,
LocalPort => $cport,
Proto => 'tcp',
Listen => 0,
ReuseAddr => 1,
);
($csock, $c_addr) = $sock->accept();
($c_port, $c_ip) =
sockaddr_in($c_addr);
$c_ipnum = inet_ntoa($c_ip);
print "Client connecting from:
$c_ipnum:$c_port\n";
Once $csock gets defined (client connection), I would like the server
to stop listening for new connections. If I use close on the original
$sock it closes $csock as well so I'm not quite sure how to go about
achieving this. I'm pretty new to socket programming in Perl, so any
ideas would be helpful.
Thanks!
connections after the inital client connects. I'm creating the socket
as such:
$sock = new IO::Socket::INET(
LocalHost => $cip,
LocalPort => $cport,
Proto => 'tcp',
Listen => 0,
ReuseAddr => 1,
);
($csock, $c_addr) = $sock->accept();
($c_port, $c_ip) =
sockaddr_in($c_addr);
$c_ipnum = inet_ntoa($c_ip);
print "Client connecting from:
$c_ipnum:$c_port\n";
Once $csock gets defined (client connection), I would like the server
to stop listening for new connections. If I use close on the original
$sock it closes $csock as well so I'm not quite sure how to go about
achieving this. I'm pretty new to socket programming in Perl, so any
ideas would be helpful.
Thanks!