- Fresh Python 3.8 Installation
- Windows 10 1903
- Using PyCharm
- Tried port 80, 3333, random ports
- Not running any KNOWN servers on my machine.
- Windows Firewall is turned off
- Antivirus software is turned off
- netstat -ao does not show any process hogging port 80 or any tested port.
- Telnet is not installed by default in Windows 10. This should not be mentioned as a possible answer?
Code:
import socket
host, port = "", 3333
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
s.bind((host, port))
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
while True:
packet = s.recv(65565)
print(packet)
Error:
C:\Users\Me\PycharmProjects\packets\venv\Scripts\python.exe C:/Users/Me/PycharmProjects/packets/socket_test.py
Traceback (most recent call last):
File "C:/Users/Me/PycharmProjects/packets/socket_test.py", line 4, in <module>
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
File "C:\Users\Me\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 231, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions