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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcefully Close a Port?

Status
Not open for further replies.

xhonzi

Programmer
Jul 29, 2003
196
US
Is there a utility/command (either Unix standard or something I can go download) that I can use to forcefully close a hung port? We encounter a situation where we get hung ports that inhibit our software from working correctly. Closing the process that is holding the port open often leaves it in a "Fin_Wait" (or maybe it's Close_Wait or Time_Wait) state and it doesn't go away for a long time. We have to reboot the server to clear it up, which is not an acceptable solution. This is in Irix 6.5.28.

Thanks,
Xhonzi
 
You can use lsof to see exactly what process is running on the port.

IE

lsof -i tcp:8080

migh return something like this:

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 14987 pvcs 4u IPv4 639978 TCP *:webcache (LISTEN)


you could then kill the pid listed. Of course, depending on what you kill, you may have to restart the appropriate daemon.


You can find info on lsof here:
 
We've been using fuser. Killing that process is what leaves us in the FIN_WAIT state that I mentioned in the previous post. I will have to check into the 'lsof' command.

Xhonzi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top