[Tutor] Question about an example in Python doc

Walter Prins wprins at gmail.com
Fri Feb 10 15:33:37 CET 2012


On 10 February 2012 14:12, daedae11 <daedae11 at 126.com> wrote:
> Traceback (most recent call last):
>   File "E:\c language\Eclipse\example\src\sniffer.py", line 12, in <module>
>     s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
>   File "D:\Python27\lib\socket.py", line 187, in __init__
>     _sock = _realsocket(family, type, proto)
> socket.error: [Errno 10013]

A bit of googling suggests that "ErrNo 10013" means "Access denied".
The error therefore presumably results because raw sockets require
elevated (Administrator) privileges.  The documentation you're
referring to actually states as much: "The last example shows how to
write a very simple network sniffer with raw sockets on Windows. The
example requires administrator privileges to modify the interface:"
So I conclude you need to run your script as administrator (and
apparently have not done so above.)


More information about the Tutor mailing list