Code to run tests on the Ethernet library

Dependencies:   EthernetInterface mbed-rtos mbed

Committer:
lawless
Date:
Sun Oct 27 09:59:50 2013 +0000
Revision:
0:3f5638515f99
Child:
1:effed2d57b6c
First test. Discovered Ethernet checksums are not calculated by the library. Have reported in the forum but seeing as I got no reply to my last comment, I guess I'll have to fix it myself.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lawless 0:3f5638515f99 1 #include "mbed.h"
lawless 0:3f5638515f99 2 #include "EthernetInterface.h"
lawless 0:3f5638515f99 3
lawless 0:3f5638515f99 4 int main() {
lawless 0:3f5638515f99 5 EthernetInterface eth;
lawless 0:3f5638515f99 6 eth.init("192.168.9.8", "255.255.255.0", "192.168.9.1");
lawless 0:3f5638515f99 7 eth.connect();
lawless 0:3f5638515f99 8 printf("IP Address is %s\n", eth.getIPAddress());
lawless 0:3f5638515f99 9
lawless 0:3f5638515f99 10 UDPSocket sock;
lawless 0:3f5638515f99 11 sock.init();
lawless 0:3f5638515f99 12
lawless 0:3f5638515f99 13 Endpoint seven;
lawless 0:3f5638515f99 14 seven.set_address("192.168.9.7", 37);
lawless 0:3f5638515f99 15
lawless 0:3f5638515f99 16 char out_buffer[] = "plop"; // Does not matter
lawless 0:3f5638515f99 17
lawless 0:3f5638515f99 18 while(1) {
lawless 0:3f5638515f99 19 sock.sendTo(seven, out_buffer, sizeof(out_buffer));
lawless 0:3f5638515f99 20 wait(1);
lawless 0:3f5638515f99 21 }
lawless 0:3f5638515f99 22
lawless 0:3f5638515f99 23 sock.close();
lawless 0:3f5638515f99 24
lawless 0:3f5638515f99 25 eth.disconnect();
lawless 0:3f5638515f99 26 }