Bonjour/Zerconf library

Dependencies:   mbed

main.cpp

Committer:
dirkx
Date:
2010-07-21
Revision:
0:355018f44c9f
Child:
1:59820ca5c83a

File content as of revision 0:355018f44c9f:

#include "mbed.h"

// Ethernet, DHCP
#include "EthernetNetIf.h"

// mDNS response to announce oneselve
#include "services/mDNS/mDNSResponder.h"

DigitalOut myled(LED1);
EthernetNetIf eth;
mDNSResponder mdns;

int main() {
    EthernetErr ethErr = eth.setup();
    if (ethErr) {
        printf("Error %d in setup on DHCP.\r\n", ethErr);
        return -1;
    }
    printf("Trying to get IP address\r\n");
    IpAddr ip = eth.getIp();
    printf("mbed IP Address is %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);

    mdns.announce(ip, "_http._tcp", 80, "May the blood run free", "path=/sample");

    printf("Entering while loop Net::poll()ing\r\n");
    while (1) {
        Net::poll();
    }
}