1850438 Members
3017 Online
104054 Solutions
New Discussion

Socket management

 
Rapid River
New Member

Socket management

Hi everybody.
Does anybody know how to deal with and manage TCP and UDP socket ? Examples given of intended features:
1) how to find what process uses a specific socket
2) how to close orphans sockets or socket in FIN_WAIT FIN_WAIT2 status
3) how to reset a malfunctioning one

As I know similar features are provided by ipcrm and ipcs in the IPC area.
2 REPLIES 2
Santosh Nair_1
Honored Contributor

Re: Socket management

1. use lsof -i :. This will show you the process that owns the port. You can get lsof from ftp://vic.cc.purdue.edu/pub/tools/unix/lsof.

2. Here is a url that talks about cleaning up sockets left in FIN_WAIT state...

http://aa11.cjb.net/hpux_admin/1997/0447.html

3. Bounce the process bound to that socket.

Hope this helps.

-Santosh
Life is what's happening while you're busy making other plans
rick jones
Honored Contributor

Re: Socket management

the lsof pointer is goodness.

do not use 10.20 and earlier scripts on an 11.0 or later system...

also, those "kill scripts" are IMO a nasty, evil, smelly kludge... not that I feel strongly on the topic... most often used when the applications themselves are buggy. not that I have strong feelings on the topic :)

hp-ux 11 should automagically cull FIN_WAIT_2's - after tcp_keepalive_detached_interval it will begin sending keepalive probes based on the normal TCP retransmission settings and will continue until a response is heard or tcp_ip_abort_interval expires. FIN_WAIT_1 is an active retransmission start and will also go away based on the TCP retransmission settings.

if you have an application that will not restart while there are old connections in any state other than LISTEN it implies there is a bug in the _app_ itself. apps should be setting SO_REUSEADDR with setsockopt() before trying to bind() to their well-known port number(s)
there is no rest for the wicked yet the virtuous have no pillows