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

c_c midnacc at gmail.com
Tue Nov 16 23:36:06 EST 2010


libpcap

On Wed, Nov 17, 2010 at 4:57 AM, MRAB <python at mrabarnett.plus.com> wrote:

> On 16/11/2010 20:38, Hans wrote:
>
>> Hi,
>>
>> Maybe it's a very simple question. I'm trying to write a dhcpclient
>> code with python. The dhcpclient does not have ip address at the very
>> beginning, it sends out dhcpdiscover and then server sends back
>> dhcpoffer. the dhcpoffer will use assigned ip as destination ip, but
>> that ip is not client's local ip yet. How can I make my socket to
>> receive that packet?
>>
>> 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.
>>
>> How to solve it? Thanks in advance.
>>
>>  Have you read this:
>
>    http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101117/e8c0e0b3/attachment-0001.html>


More information about the Python-list mailing list