Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kill a port

Status
Not open for further replies.

NetworkGhost

IS-IT--Management
Apr 12, 2005
1,324
US
Is there a way to Kill a port that remains open or hangs after the process that uses it has been killed?
 
Possibly disable then enable.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
I am not to familiar with Unix but it is a Licensing Application
 
Odds are if the port is not closing down, there is a process still running. I would look into the lsof command or netstat -na.
 
As last resort reboot the unix box, and avoid to kill a licensing app...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I have the same problem in the past with a database program, the manufactor said that the only way to release the port was to reboot. Not the best answer, but it worked.
 
I had a similar problem recently with a database which refused to release a port on my HPUX 11 server. Our unix admins were unable to come up with a solution so I spent some time browsing for a solution. I found the following:

"Find the TCP instance data and then use tcp_discon to remove the instance as follows:

# ndd -get /dev/tcp tcp_status
TCP dest snxt suna swnd cwnd rnxt rack rwnd rto mss [lport,fport] state

0183b8b4 015.043.233.086 533cb8ce 533cb8ce 00008000 00003000 533bc583 533bc583
00000000 02812 04096 [c00a,cea9] TCP_CLOSE_WAIT

So, if you wanted to remove this connection:
# ndd -set /dev/tcp tcp_discon 0x0183b8b4

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 I 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"

I have as yet been unable to test this out for myself so I cannot confirm that it works. If you manage to substantiate it please do let me know!
 
The information given in my previous post is taken from the HP forum site and relates specifically to HPUX. I can post the link if that is allowed.
 
Of course it's allowed. That ndd-set looks very useful; can't think of anything quite like it on other Unixes. I did find it on Solaris, was surprised not to find it in Unixware (Solaris and Unixware are very similar). Good to know it's in HPUX.

Tony Lawrence
Linux/Unix/Mac OS X Resources
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top