View previous topic :: View next topic |
Author |
Message |
dolphinX
Joined: 05 Dec 2009 Posts: 2
|
Posted: Sat Dec 05, 2009 6:11 am Post subject: a fix for windows |
|
|
After I installed VMWare, miniupnp did't work. VMWare add 2 Virtual Ethernet Adapters into my system. I guess upnp would fail when the system had 2 or more adapters.
Here's the fix for Windows.
miniupnpc.c
add
Code: | #include <IPHlpApi.h> |
for WIN32
in function upnpDiscover
at first
add else part
Code: | #else
MIB_IPFORWARDROW ip_forward; |
and change
Code: | sockudp_w.sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR); |
to
Code: | #ifdef WIN32
if ( GetBestRoute(inet_addr("223.255.255.255"), 0, &ip_forward) != NO_ERROR) return NULL;
sockudp_w.sin_addr.s_addr = ip_forward.dwForwardNextHop;
#else
sockudp_w.sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
#endif |
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Dec 07, 2009 12:24 pm Post subject: |
|
|
Thank you very much.
Only one question :
Why GetBestRoute(inet_addr("223.255.255.255"), 0, &ip_forward) and not GetBestRoute(inet_addr("239.255.255.250"), 0, &ip_forward) (UPNP_MCAST_ADDR) _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Mon Dec 07, 2009 3:22 pm Post subject: |
|
|
also, what is the value is returned in ip_forward.dwForwardNextHop; ? _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
dolphinX
Joined: 05 Dec 2009 Posts: 2
|
Posted: Mon Dec 07, 2009 3:40 pm Post subject: |
|
|
Actually, this code is found from ACAT UPNP.
223.255.255.255 is the end address of class c ip.
I've test minutes ago that 239.255.255.250 is not work.
ip_forward.dwForwardNextHop on my pc is 0x0101a8c0 (192.168.1.1).
btw, GetBestRoute's Minimum supported client is Windows 2000. |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Thu Dec 10, 2009 9:55 pm Post subject: |
|
|
Hum I tested the code under Windows (vista) today and it didnt worked for me, so I reverted to the old code (which work)... _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
|