Score:1

Cannot bind to tcp port but no application listens to it

nz flag

I am looking for a way to find out any process that may prevent binding to a port on a windows 10 machine.

My issue is that I have a server application that cannot open a socket on port 7777, sometimes it is 2809 that is blocked. The issue is not always happening, but it is reccurrent and even rebooting sometimes doesn't fix the problem. But at one point the problem disappears but then resurfaces randomly days or weeks later.

I tried:

  • tcpview: could not find any process using the port

  • netstat -anbo: could not find any process using the port

  • Telnet to the port, using all IPs ipconfig /all would return, no
    connection to anything.

  • Created my own little java program to test binding on the port and make sure it's not a false negative, I am getting this result:

    Address already in use: JVM_Bind

    java.net.BindException: Address already in use: JVM_Bind

  • I used Wireshark to sniff the packets, can't find anything to that port.

  • Disable the firewall

  • Disable network adapters

  • Stop all Hyper-V related and Docker desktop services

  • Disable Anti-Virus

  • Rebooting

Still out of luck finding out what blocks this port.

Anyone has a suggestion?

Score:1
us flag

Have you tried netstat, like this?

netstat -ano | findstr :7777

Otherwise you cloud try Resource Monitor > Network Tab > Listening Ports, if you prefer a GUI.

svachon avatar
nz flag
Yes I tried this and no luck
Manu avatar
us flag
if so, I'm pretty sure, your problem is not cause by the port being occupied. Can you name your server application and what is also hosted on this machine?
svachon avatar
nz flag
That's a local websphere app server that I use for dev purposes. It won't start when that port issue arises. But even after a reboot, sometimes I still have the port used, and I am not even running the WAS server, I simply run my Java test program to see if I can bind a socket to that port and I am getting the error. I am suspecting something is not releasing resources properly on the O/S which makes it think the port is still in use.
Manu avatar
us flag
then I'd say your problem is not caused by a occupied listener. unfortunately I am not able to provide know how on these products or java
svachon avatar
nz flag
Thanks for trying to help, I plan to code another program in either .net or python that tries to listen on that problem port just to validate if it's a pure java/jvm issue or if the issue is system wide.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.