how to use socket to get packet which destination ip is not local?

Mark Wooding mdw at distorted.org.uk
Wed Nov 17 11:08:04 EST 2010


Hans <hansyin at gmail.com> writes:

> I tried socket bind to 0.0.0.0, but it only binds to any local ip, not
> any ip which may not be local. therefore the socket cannot get that
> dhcp offer packet even I can use wireshark to see that packet did come
> to this pc.

You must use a raw socket for this.  Raw sockets are fiddly, not very
portable, and require privilege.  Sorry.

-- [mdw]



More information about the Python-list mailing list