OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions flask flask

OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions


I got exact same error when trying to start Visdom server:

OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

The reason was that there was another process using the same port as Visdom wanted to use which in my case is port 8097.

To debug this I followed these steps:

  1. Use TcpView from Sysinternals to find the process using the port.
  2. If the process turns out to be svchost.exe then you need to find the service that uses this port. To do this run the command: `tasklist /svc /FI "PID eq 1234" where replce 1234 from PID you see in TcpView.
  3. Open Windows Services applet and look for this server. In my case this turned out to be "Delivery Optimization" or DOSvc service which basically uses P2P download of Windows Update bits if you are on large network. I turned off that service temporarily and able to open the port again.


Its happens because your firewall is blocking connection for SQL Server.Go to Control Panel -> Windows Defender Firewall -> Advance Setting -> Outbound rule (Block network access R local) will be in Red colour -> right click -> Properties and then allow all connection and Save