470,594 Members | 1,499 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

Close Socket Connection

$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
1 9231
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.

Similar topics

3 posts views Thread by Daniel | last post: by
4 posts views Thread by Haim | last post: by
14 posts views Thread by =?Utf-8?B?TWlrZVo=?= | last post: by
3 posts views Thread by A. W. Dunstan | last post: by
reply views Thread by meLlamanJefe | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.