File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes externally close a socket port? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "externally close a socket port? " Watch "externally close a socket port? " New topic

externally close a socket port?

Elhanan Maayan
Ranch Hand

Joined: May 04, 2009
Posts: 136

is there a command line utility that would allow me to close a specific port a java program is using?

the reason is this, we have a product that for some reason at a specific time of day emits a large number of socket closed, as it's tries to repeatedly to open a connection and fails, after a while the products it self fails to connect to anything.

although we don't know the reason why the socket is closing we would like the ability to re-produce sudden socket close to see what happens on your development environment , while my team leader created a small thread which wakes up every 30 seconds and closes the socket i feel it does not reflect correctly the problem as it's still within the jvm itself which may cause it to act differently, so i'm looking for something similar to tcpview only in command line (no tcpvcons does have such an option).
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Sure, the NETSTAT command lets me do that. At least on the operating system I'm using. You might have had a different operating system in mind -- I can't tell from your post.
Elhanan Maayan
Ranch Hand

Joined: May 04, 2009
Posts: 136
mine is windows 7
I agree. Here's the link:
subject: externally close a socket port?
It's not a secret anymore!