Tiny DNS Resolver

Dependencies:   EthernetNetIf mbed

main.cpp

Committer:
okini3939
Date:
2011-07-21
Revision:
0:477d4e2f281a

File content as of revision 0:477d4e2f281a:

#include "mbed.h"
#include "EthernetNetIf.h"
#include "TinyResolver.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
EthernetNetIf eth; 

int main () {
    EthernetErr ethErr;
    uint32_t addr;

    myled = 1;

    ethErr = eth.setup();
    if(ethErr) {
        return -1;
    }

	getHostByName(IpAddr(192,168,1,1), "mbed.org", &addr);

	printf("IP address: %d.%d.%d.%d\r\n", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);

    myled = 0;
	return 0;
}