12-03-2015
Both, XrAy and agent.kgb are correct: a TCP connection works like a telephone call. First, a so-called "virtual channel" (the call) ist established by both sides (one calls, one picks up the handset). Then, the connection remains in use (the connected people talk to each other) until, finally, one or both sides drop it (they hang up).
The CLOSE_WAIT means, that one has already hung up and this side now is also in the process of dropping the connection. In TCP this is just a bit more complicated with acknowledgements being sent back and forth, but in principle the difference is minimal.
So, what you want amounts to "i want to still talk to someone who just hung up". With a phone you would know what to do: redial and establish a new connection. Here, you do the same: you(r application) needs to reestablish another TCP connection.
Maybe your application was a bit too eager to drop the connection. In this case you must change the application somehow. But this will not change the fact that dropped connections remain dropped, no matter what you want. *)
I hope this helps.
bakunin
_______________
*) Corollary: For better or worse, unlike in Zombie movies dead connections remain dead and won't come back to haunt you.
Last edited by bakunin; 12-03-2015 at 10:14 AM..
These 2 Users Gave Thanks to bakunin For This Post:
10 More Discussions You Might Find Interesting
1. Programming
I have a SUN environment running an WebLogic that communicates w/a 3rd party running IIS. When the IIS site goes down (frequently), I am stuck with sockets in an ESTABLISHED state, and cannot seem to figure out how to avoid this. No exceptions are thrown as I can still open connections to the IIS... (1 Reply)
Discussion started by: teledelux
1 Replies
2. Programming
Hello there chaps.
First of all, i'm no TCP/IP-wiz, so forgive me if this is a stupid question.
I've been messing around with filetransfer using sockets, and there is one thing that confuses me.
This is how it's set up:
A server app listens on a port for a client connection.
When it... (3 Replies)
Discussion started by: crippe
3 Replies
3. UNIX for Dummies Questions & Answers
If I do a netstat -a I can see all the sockets currently open, is there a way that I can tell which application is holding open these sockets ? (3 Replies)
Discussion started by: murphyboy
3 Replies
4. AIX
I have what appears to be a unique socket problem, although admittedly my tcp/ip programming experience is relatively limited.
I have a AIX server process using TCP/IP berkely sockets, and a Windows (C#) process. The windows process takes input from a user and sends a message to the Unix... (1 Reply)
Discussion started by: adiaconou
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Occasionally I am getting the port state in CLOSE_WAIT for long time in the solaris server. I am not sure is it application problem or not. Because we are using port 9009 for Tomcat process in our web application, some time when I start the application, the port 9009 is in CLOSE_WAIT... (0 Replies)
Discussion started by: mgmk.84
0 Replies
6. Programming
Hello,
I'm trying to write a small c application to test a tcp port. This works fine for the most part but the default timeout on the connect is very long. I have been reading many posts but and it looks like I need to set the socket to be non-blocking and poll for a result. I have been totally... (2 Replies)
Discussion started by: tjones1105
2 Replies
7. Solaris
Hi,
I am using solaris 10.
I have opened a socket connection using java in solaris 10 operating system, the port went to LISTEN state and able to create new socket connection and the new connections went to ESTABLISHED state.
If I issue the command "netstat -an | grep <<portnumber>>", I... (10 Replies)
Discussion started by: kumar3k
10 Replies
8. IP Networking
Hello,
Our software is using a TCP socket (AF_INET, SOCK_STREAM) to communicate with an Ethernet device. When we send a message, the message object writes itself in full onto the socket's stream buffer before the software invokes send() from socket.h.
I'm still researching, but have 2... (1 Reply)
Discussion started by: bix_20002000
1 Replies
9. Shell Programming and Scripting
Hello all,
I have a requirement to read and write to a tcp socket from an HP-UX shell script. I see a /dev/tcp character device on my servers:
crw-rw-rw- 1 root root 72 0x00004f Mar 28 18:37 /dev/tcp
So I believe this is what I should use. The problem is that all the... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies
10. Shell Programming and Scripting
Hello Friends,
First of all im sorry for spending extra space in DB of forum with this thread, i know there would be a solution if i kept searching,
I need to terminate the process which causes CLOSE_WAIT status of TCP connection via port 8103:
-bash-3.00$ netstat -na | grep 8103... (3 Replies)
Discussion started by: EAGL€
3 Replies
LEARN ABOUT OSX
lwp::conncache
LWP::ConnCache(3) User Contributed Perl Documentation LWP::ConnCache(3)
NAME
LWP::ConnCache - Connection cache manager
NOTE
This module is experimental. Details of its interface is likely to change in the future.
SYNOPSIS
use LWP::ConnCache;
my $cache = LWP::ConnCache->new;
$cache->deposit($type, $key, $sock);
$sock = $cache->withdraw($type, $key);
DESCRIPTION
The "LWP::ConnCache" class is the standard connection cache manager for LWP::UserAgent.
The following basic methods are provided:
$cache = LWP::ConnCache->new( %options )
This method constructs a new "LWP::ConnCache" object. The only option currently accepted is 'total_capacity'. If specified it
initialize the total_capacity option. It defaults to the value 1.
$cache->total_capacity( [$num_connections] )
Get/sets the number of connection that will be cached. Connections will start to be dropped when this limit is reached. If set to 0,
then all connections are immediately dropped. If set to "undef", then there is no limit.
$cache->capacity($type, [$num_connections] )
Get/set a limit for the number of connections of the specified type that can be cached. The $type will typically be a short string
like "http" or "ftp".
$cache->drop( [$checker, [$reason]] )
Drop connections by some criteria. The $checker argument is a subroutine that is called for each connection. If the routine returns a
TRUE value then the connection is dropped. The routine is called with ($conn, $type, $key, $deposit_time) as arguments.
Shortcuts: If the $checker argument is absent (or "undef") all cached connections are dropped. If the $checker is a number then all
connections untouched that the given number of seconds or more are dropped. If $checker is a string then all connections of the given
type are dropped.
The $reason argument is passed on to the dropped() method.
$cache->prune
Calling this method will drop all connections that are dead. This is tested by calling the ping() method on the connections. If the
ping() method exists and returns a FALSE value, then the connection is dropped.
$cache->get_types
This returns all the 'type' fields used for the currently cached connections.
$cache->get_connections( [$type] )
This returns all connection objects of the specified type. If no type is specified then all connections are returned. In scalar
context the number of cached connections of the specified type is returned.
The following methods are called by low-level protocol modules to try to save away connections and to get them back.
$cache->deposit($type, $key, $conn)
This method adds a new connection to the cache. As a result other already cached connections might be dropped. Multiple connections
with the same $type/$key might added.
$conn = $cache->withdraw($type, $key)
This method tries to fetch back a connection that was previously deposited. If no cached connection with the specified $type/$key is
found, then "undef" is returned. There is not guarantee that a deposited connection can be withdrawn, as the cache manger is free to
drop connections at any time.
The following methods are called internally. Subclasses might want to override them.
$conn->enforce_limits([$type])
This method is called with after a new connection is added (deposited) in the cache or capacity limits are adjusted. The default
implementation drops connections until the specified capacity limits are not exceeded.
$conn->dropping($conn_record, $reason)
This method is called when a connection is dropped. The record belonging to the dropped connection is passed as the first argument and
a string describing the reason for the drop is passed as the second argument. The default implementation makes some noise if the
$LWP::ConnCache::DEBUG variable is set and nothing more.
SUBCLASSING
For specialized cache policy it makes sense to subclass "LWP::ConnCache" and perhaps override the deposit(), enforce_limits() and
dropping() methods.
The object itself is a hash. Keys prefixed with "cc_" are reserved for the base class.
SEE ALSO
LWP::UserAgent
COPYRIGHT
Copyright 2001 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.2 2012-01-13 LWP::ConnCache(3)