Operating System - HP-UX
1822523 Members
2505 Online
109642 Solutions
New Discussion юеВ

Re: HOW TO FREE AN 'ESTABLISHED' PORT

 
Gary Yu
Super Advisor

HOW TO FREE AN 'ESTABLISHED' PORT

Hi experts,

Some of our applictions exited or died, but the ports they were using still not freed, the status of the ports from 'netstat -a' is 'ESTABLISHED', how can I free the ports without reboot the machine?

Thanks!
2 REPLIES 2
Sridhar Bhaskarla
Honored Contributor

Re: HOW TO FREE AN 'ESTABLISHED' PORT

On 10.20, I was using netstat -Aan to get the PCB address of the socket and then used adb to clear the address with MSLOFFSET from tcp_var.h. I found this tip somewhere.

I couldn't try this on 11.0 as they are not valid anymore. I had seen people suggesting to use ndd with tcp_discon_by_addr but never used due to the fear that HP doesn't like it as it's being unsupported.

You can do an lsof and get the processes that are still using the port. You can kill the ones that haven't become jomby.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Carsten Krege
Honored Contributor

Re: HOW TO FREE AN 'ESTABLISHED' PORT

The option tcp_discon_by_addr is used for disconnection an established TCP connection regardless of it's state. The other possibility is to use tcp_discon.

If you want to use the tcp_discon_by_addr, you use a 24 byte string that contains the hex representation of the 'quadruple'. For example if the connection that you want to delete is:

Local IP 192.1.2.3 0xc0010203
Local Port 1024 0x0400
Remote IP 192.4.5.6 0xc0040506
Remote Port 2049 0x0801


The "hex" string you pass to tcp_discon_by_addr is:

ndd -set /dev/tcp tcp_discon_by_addr "c00102030400c00405060801"

NOTE: the preceding 0x that typically indicates a Hex number is NOT part of the string passed.

NOTE: Using the option tcp_discon_by_addr is NOT supported by HP!!!!!

Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG