W5200(WIZ820io) network interface
Diff: MyNetDnsRequest.cpp
- Revision:
- 1:803123933c5a
- Parent:
- 0:61831b843b44
- Child:
- 2:a8df39b4f3aa
--- a/MyNetDnsRequest.cpp Sat Apr 14 17:21:11 2012 +0000 +++ b/MyNetDnsRequest.cpp Tue Apr 17 12:13:15 2012 +0000 @@ -1,9 +1,10 @@ -// MyNetDnsRequest.cpp 2012/4/13 +// MyNetDnsRequest.cpp 2012/4/16 #include "mbed.h" #include "MyNetDnsRequest.h" #include "UDPSocket.h" #include <string> #include "dnsname.h" +#include "w5200NetIf.h" //#define DEBUG @@ -120,8 +121,13 @@ m_udp = new UDPSocket; } m_udp->setOnEvent(this, &MyNetDnsRequest::callback); - Host local(IpAddr(0,0,0,0), 1243); - Host server(IpAddr(8,8,8,8), 53); // DNS + Host local(IpAddr(0,0,0,0), 1024 + rand()&0x7fff); + IpAddr dns(8,8,8,8); + NetIf* pIf = Net::getDefaultIf(); + if (pIf) { + dns = ((w5200NetIf*)pIf)->m_dns; + } + Host server(dns, 53); // DNS m_udp->bind(local); uint8_t buf[256]; int size = query(buf, sizeof(buf), hostname);