1

To begin with, I know this has been asked and answered before but I can not seem to get it to work with the solutions provided in previous threads. (I am running windows 10 and Python 3.8.1)

So I have not had this problem before, and I have been working with the same socket "config" for several months without any issues. I started working on a company server a few weeks back with no issues but I performed a windows update last night and now it is not working. To simplify the problem I made the two scripts:

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((socket.gethostname(), 3333))
s.listen(5)

clientsocket, address = s.accept()

And:

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((socket.gethostname(), 3333))

And I get the following error:

Traceback (most recent call last): File "connect_to_socket.py", line 4, in s.connect((socket.gethostname(), 3333)) OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

Any ideas to solve it?

Changing socket from 3333 to something else does not seem to fix the issue.

Best regards, Jakob

JakobVinkas
  • 1,003
  • 7
  • 23

1 Answers1

0

I found the problem, the company I work for changed their VPN policy (or something). The code works as usual when i disconnect from the VPN.

JakobVinkas
  • 1,003
  • 7
  • 23