in reply to why i don't receive DHCPDiscover message from server using dongle and why same code give DHCPNac on wifi

I'm not sure what you're trying to do here. Windows already does DHCP for you. But nevertheless:

  1. use strict; use warnings;
  2. When I run this on Strawberry 5.18.1 MSWin32-x64-multi-thread on Windows 7 x64, I get:
    "Can't create socket: IO::Socket::INET: Only one usage of each socket address (protocol/network address/port) is normally permitted."

This makes sense as my local UDP 68 port is in use by svchost.exe for DHCP services already. When I switch to a non-well-known-port (e.g., 6800) it runs but it doesn't send the packet out the interface I expected - which may be your problem when using the alternate NIC. I determined this with a packet capture (Wireshark) capturing on all interfaces with filter 'udp.srcport == 6800'.

Windows has a preferred interface to send traffic out when there are several matches in the host route table. In this case, your destination of 255.255.255.255 could be for *any* network interface / card, so the default one is used, which by priority, may not be the one you "want".

  • Comment on Re: why i don't receive DHCPDiscover message from server using dongle and why same code give DHCPNac on wifi
  • Download Code