Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Documentation
In the example of thesocket.rst, the comment# receive all packages should be changed to# receive all packets and the commentreceive a package should be changed toreceive a packet.
import socket# the public network interfaceHOST = socket.gethostbyname(socket.gethostname())# create a raw socket and bind it to the public interfaces = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)s.bind((HOST, 0))# Include IP headerss.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)# receive all packagess.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)# receive a packageprint(s.recvfrom(65565))# disabled promiscuous modes.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)