Tiny DNS Resolver

Dependencies:   EthernetNetIf mbed

Committer:
okini3939
Date:
Thu Jul 21 16:53:11 2011 +0000
Revision:
0:477d4e2f281a

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:477d4e2f281a 1 #include "mbed.h"
okini3939 0:477d4e2f281a 2 #include "EthernetNetIf.h"
okini3939 0:477d4e2f281a 3 #include "TinyResolver.h"
okini3939 0:477d4e2f281a 4
okini3939 0:477d4e2f281a 5 DigitalOut myled(LED1);
okini3939 0:477d4e2f281a 6 Serial pc(USBTX, USBRX);
okini3939 0:477d4e2f281a 7 EthernetNetIf eth;
okini3939 0:477d4e2f281a 8
okini3939 0:477d4e2f281a 9 int main () {
okini3939 0:477d4e2f281a 10 EthernetErr ethErr;
okini3939 0:477d4e2f281a 11 uint32_t addr;
okini3939 0:477d4e2f281a 12
okini3939 0:477d4e2f281a 13 myled = 1;
okini3939 0:477d4e2f281a 14
okini3939 0:477d4e2f281a 15 ethErr = eth.setup();
okini3939 0:477d4e2f281a 16 if(ethErr) {
okini3939 0:477d4e2f281a 17 return -1;
okini3939 0:477d4e2f281a 18 }
okini3939 0:477d4e2f281a 19
okini3939 0:477d4e2f281a 20 getHostByName(IpAddr(192,168,1,1), "mbed.org", &addr);
okini3939 0:477d4e2f281a 21
okini3939 0:477d4e2f281a 22 printf("IP address: %d.%d.%d.%d\r\n", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
okini3939 0:477d4e2f281a 23
okini3939 0:477d4e2f281a 24 myled = 0;
okini3939 0:477d4e2f281a 25 return 0;
okini3939 0:477d4e2f281a 26 }