I'm attempting to build a UDP-based data logger using the StrippedDownNetServices library. (Sorry, I put the wrong library name in the posting title!) The mbed application will acquire data and then send UDP packets to a remote host. Unfortunately, I'm having trouble getting past the first step. In the attached test program I would expect to see a data packet arriving at 192.168.1.8 once per second but I see nothing.
#include "mbed.h"
#include "EthernetNetIf.h"
#include "UDPSocket.h"
int main() {
EthernetNetIf eth(
IpAddr(192,168,1,2), //IP Address
IpAddr(255,255,255,0), //Network Mask
IpAddr(192,168,1,1), //Gateway
IpAddr(192,168,1,1) //DNS
);
eth.setup();
Host destHost(IpAddr(192,168,1,8), 55555);
Host localHost(IpAddr(), 10000);
UDPSocket udpSocket;
udpSocket.bind(localHost);
char sendBuffer[8] = { '1', '2', '3', '4', '5', '6', '7', '8'};
for (int i = 0; i < 1000; i++) {
udpSocket.sendto(sendBuffer, 8, &destHost);
wait(1);
}
}
I used tcpdump to try to figure out what the problem might be and to my surprise, the mbed network stack doesn't seem to be responding to arp replies. I see the following network traffic repeated over and over again once per second.
16:01:14.271964 arp who-has hugh-laptop.local tell 192.168.1.2
0x0000: ffff ffff ffff 0002 f7f0 3079 0806 0001 ..........0y....
0x0010: 0800 0604 0001 0002 f7f0 3079 c0a8 0102 ..........0y....
0x0020: 0000 0000 0000 c0a8 0108 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 0000 0000 ............
16:01:14.271982 arp reply hugh-laptop.local is-at 00:01:4a:9d:d5:95 (oui Unknown)
0x0000: 0002 f7f0 3079 0001 4a9d d595 0806 0001 ....0y..J.......
0x0010: 0800 0604 0002 0001 4a9d d595 c0a8 0108 ........J.......
0x0020: 0002 f7f0 3079 c0a8 0102 ....0y....
What in the world am I doing wrong? BTW, I wrote another test program to see if Ethernet packets are making out of the mbed. It appears that they are. Here's the test program.
#include "mbed.h"
Ethernet eth;
int main() {
char buf[16];
buf[0] = 0;
while(1) {
eth.write(buf, 16);
eth.send();
buf[0] += 1;
wait(1);
}
}
And here is some typical network traffic.
15:58:46.479969 arp-#0 for proto #0 (0) hardware #1 (0)
0x0000: d2ff ffff ffff 0001 4a9d d595 0806 0001 ........J.......
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 0000 0000 ............
15:58:47.479979 arp-#0 for proto #0 (0) hardware #1 (0)
0x0000: d3ff ffff ffff 0001 4a9d d595 0806 0001 ........J.......
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 0000 0000 ............
My hardware setup is an LPC1768 plugged into a coolcomponents development board. I'm using a Linksys Etherfast 10/100 switch to link my computer and the mbed.
I'm attempting to build a UDP-based data logger using the StrippedDownNetServices library. (Sorry, I put the wrong library name in the posting title!) The mbed application will acquire data and then send UDP packets to a remote host. Unfortunately, I'm having trouble getting past the first step. In the attached test program I would expect to see a data packet arriving at 192.168.1.8 once per second but I see nothing.
I used tcpdump to try to figure out what the problem might be and to my surprise, the mbed network stack doesn't seem to be responding to arp replies. I see the following network traffic repeated over and over again once per second.
What in the world am I doing wrong? BTW, I wrote another test program to see if Ethernet packets are making out of the mbed. It appears that they are. Here's the test program.
And here is some typical network traffic.
My hardware setup is an LPC1768 plugged into a coolcomponents development board. I'm using a Linksys Etherfast 10/100 switch to link my computer and the mbed.