SOCK_RAW and IPPROTO_TCP is error running python code,the error is WinError 10022

bertram 1 Reputation point
2021-12-22T06:48:47.323+00:00

import socket

def tcpsniffer():
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)

while True:
    packet = s.recvfrom(1024)
    print('recvfrom packet!')

if name == 'main':
tcpsniffer()

Windows development Windows API - Win32
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.