Hi Gerrit,
I also get this repsonse if there is no server running on the destination PC (Bytes sent: -1 is if no message has been sent). But I have a simple server running that listens on port 55555 for connections and after a connection is made it displays the data it receives.
It is when the server is running and messages are sent (Bytes sent: 6) that the Mbed hangs after 6 sends.
The simple server test program was knocked up in VB6 using the winsock control and doesn't have any problems when messages are sent from a client running on another PC, just from the Mbed. So I do not think it is a server problem.
Regards,
Arthur
Hi,
Can anyone possibly try this code on their Mbed.
For me it gets an IP address, connects to the server, sends 6 messages and then the Mbed hangs.
I am trying to determine if I have a hardware or cabling problem.
Regards,
Arthur
#include "mbed.h" #include "EthernetInterface.h" int main() { printf("Connecting\n"); EthernetInterface eth; // set up the interface eth.init(); //Use DHCP eth.connect(); // connect printf("IP Address aquired: %s\n", eth.getIPAddress()); TCPSocketConnection sock; // set up a socket sock.connect("192.168.1.200", 55555); // connect to server printf ("Connected to Server\n"); char *testmessage = "Hello\n"; int bytes; int i; for (i=0;i<100;i++) { bytes = sock.send_all(testmessage, strlen(testmessage)); printf("Message %d - Bytes sent: %d\n",i,bytes); wait_ms(10); } printf("Finished\n"); }