- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to kill an open port after the prog. which...
Operating System - HP-UX
1824994
Members
2247
Online
109678
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2002 12:11 AM
тАО03-04-2002 12:11 AM
How to kill an open port after the prog. which start it already ended?
i have a program that uses a port 1978 when it started. When the program shuts down, the port still alive and listening. I can see it by netstat -an |grep 1978. Now I can't start the program because it says the port is already being use.
How to shutdown the port?
How to shutdown the port?
tyl
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2002 12:30 AM
тАО03-04-2002 12:30 AM
Re: How to kill an open port after the prog. which start it already ended?
Hi,
First, use lsof to check for any processes still binding to the port.
If that does not work, then use ndd to force close the connection (though not recommended) via tcp_discon and/or tcp_discon_by_addr. Details at:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xbe06a22d6d27d5118fef0090279cd0f9,00.html
Hope this helps. Regards.
Steven Sim Kok Leong
First, use lsof to check for any processes still binding to the port.
If that does not work, then use ndd to force close the connection (though not recommended) via tcp_discon and/or tcp_discon_by_addr. Details at:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xbe06a22d6d27d5118fef0090279cd0f9,00.html
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2002 12:59 AM
тАО03-04-2002 12:59 AM
Re: How to kill an open port after the prog. which start it already ended?
What state does netstat say it's in?
You might want to ensure you have no FIN_WAIT states.
Check for ARPA patches if there are.
(search for FIN_WAIT2 in the patch Database)
Later,
Bill
You might want to ensure you have no FIN_WAIT states.
Check for ARPA patches if there are.
(search for FIN_WAIT2 in the patch Database)
Later,
Bill
It works for me (tm)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2002 02:26 AM
тАО03-04-2002 02:26 AM
Re: How to kill an open port after the prog. which start it already ended?
It depends what state the port is in. If its still in listen state then you'll have to use lsof as Steven suggests to track down the process that has bound to the port.
A lot of the time you'll find that there are TIME_WAIT sockets which are held open for another 4 minutes (by default) after the socket is closed. While these sockets are present another process cannot bind() to the port. There are two ways around this:
1. Wait until the time_wait sockets have disappeared before starting the application.
2. Have the application set the SO_REUSEADDR flag on the socket before calling bind(). The bind() call will now succeed even if there are sockets in the time_wait state still present. Obviously this requires a change to the code so you'll need to go back to the developers or your application vendor.
Regards,
Steve
A lot of the time you'll find that there are TIME_WAIT sockets which are held open for another 4 minutes (by default) after the socket is closed. While these sockets are present another process cannot bind() to the port. There are two ways around this:
1. Wait until the time_wait sockets have disappeared before starting the application.
2. Have the application set the SO_REUSEADDR flag on the socket before calling bind(). The bind() call will now succeed even if there are sockets in the time_wait state still present. Obviously this requires a change to the code so you'll need to go back to the developers or your application vendor.
Regards,
Steve
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP