By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,281 Members | 2,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,281 IT Pros & Developers. It's quick & easy.

Close Socket Connection

P: n/a
$r_socket = IO::Socket::INET->new(
PeerAddr => "10.0.26.78",
PeerPort => 17990,
Proto => 'tcp',
Timeout => 1
);
......................
if ($r_socket && $r_socket->connected()) {
close($r_socket);
}

after close($r_socket), i use netstat -an to check the connecting list.
i found "TCP 10.0.28.117:4998 10.0.26.78:17990 TIME_WAIT"

how to close the socket connection completely?
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <80**************************@posting.google.com >, KaXo
<ka**@sina.com> wrote:
$r_socket = IO::Socket::INET->new(
PeerAddr => "10.0.26.78",
PeerPort => 17990,
Proto => 'tcp',
Timeout => 1
);
.....................
if ($r_socket && $r_socket->connected()) {
close($r_socket);
}

after close($r_socket), i use netstat -an to check the connecting list.
i found "TCP 10.0.28.117:4998 10.0.26.78:17990 TIME_WAIT"

how to close the socket connection completely?


The socket connection is kept open for 2-4 minutes to allow stray
packets scattered all over the world-wide internet to find their way
home. This is the "TIME_WAIT" state.

You can try setting the ReusePort (or ReuseAddr?) attribute on the
socket, which will allow you to reopen the socket sooner after you have
closed it.

FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.