1

I have this frustrating Problem that my programs cannot connect to their designated Ports. I'm using a windows 10 machine and this is how my problem goes: I open a software which needs port 5053 or another which needs 50504 and they give me error that this ports are in use: 5053 Error :

Port 5053 in use, waiting...

50504 Error :

An attempt was made to access a socket in a way forbidden by its access permissions

and I can't figure out what is causing this port blockage.

I've used netstat and TCPView and there is no software or process or service that is occupying these ports, and the programs still don't open and their windows services don't start.

  • in the log of my programs it gives me the above errors (more importantly the 5053 one).

the only solution that I Could find is to run net stop hns && net start hns and after several trial and error and reloading the services exactly after running this command, they will work.

I'm not a Networking Expert, I don't know much about network fundamentals, and I got my self this far by just google searches and Scrolling forums, but I Can't find the root of this problem and fix it.

I Also Use Firewall (Kaspersky Internet Security) but I've been using it with no such problem for years

If there's anything I need to check and report or any possible cause please inform me.

7
  • Have you tried it with Kaspersky disabled? Try also to test Windows integrity by running the commands Dism /Online /Cleanup-Image /RestoreHealth and then sfc /scannow.
    – harrymc
    Commented May 18, 2023 at 17:05
  • the Host Networking Service is related to stuff that uses the system hypervisor (docker, VMs, WSL, etc). is the port in use in any containers, VMs, or WSL? Commented May 18, 2023 at 17:59
  • @harrymc I tries both of these scans and it didn't worked, also I have turned off my Kaspersky and rebooted the machine but no change... Commented May 18, 2023 at 18:02
  • 1
    Do you have any of these programs? Is there another copy of this program visible in Task Manager? Have you used netstat -a -b? See also this post for ideas.
    – harrymc
    Commented May 18, 2023 at 18:11
  • 1
    This isn’t a general networking problem or about firewalls, but rather related to how port ranges on Windows can be reserved, making them unavailable for normal use. Check this Q/A on Stack Overflow on the topic.
    – Daniel B
    Commented May 18, 2023 at 18:15

1 Answer 1

4

Thanks you very much guys(@frank-thomas , @harrymc and @daniel-b)
with your help and guidance I Finally could figure out the problem and solutions for fixing it:

Part 1 of Solution

  • After I read part of your linked posts, I found out about the Windows Port Exclusion Ranges so I ran the netsh command that was there and Found out how many Exclusion Ranges I had (around 123 Port Exclusion Ranges!!!)

netsh int ip show excludedportrange protocol=tcp

  • I asked Bard and ChatGPT what was the normal amount of Port Exclusion Ranges and they told me it varies but usually it's less than 10! and there I understood why I was struggling with this problem for months.

  • I found the ports that were giving me errors in the exclusion Ranges

  • Then I tried Disabling the Hyper-V to assign my in-use ports in a new exclusion range and then re-enable it, but I found out in my case, it didn't have so much influence on them. but it might be the solution for someone else

Part 2 of Solution

  • After that I saw this post that explained which other processes are using these exclusion Ranges and how to disable them (which was the most helpful). for me personally bellow line works when I get the same errors:

(run as administrator) net stop winnat && net start winnat

  • Then I saw this comment and I think it might've helped as well by creating a registry to disable the Excluded Port Range

for now, I don't know which one of the solutions in part 2 helped the most, but they certainly fixed my Problem.

3
  • It's a great start to an answer, but please include the essential bits here. We shouldn't need to click on links to find the solution. Commented May 18, 2023 at 23:16
  • after I saw your comment I tried to import some of the information into my answer, but I Couldn't see a short version, I Either must've placed the whole answer here or just link to it, since it has a lot of explanation going on and putting just one or two lines of it would've been irresponsible. If you see Anything I can do to clarify my answer, I'll be happy to Here About it. Commented May 20, 2023 at 4:58
  • 1
    Its an improvement Commented May 20, 2023 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .