Test to demonstrate that TCP sockets lock up

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of TCPSocket_HelloWorld by mbed official

EthernetInterface to revision 32 (mbed-rtos to revision 12, mbed to revision 63)

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Tue Jun 26 14:39:21 2012 +0000
Child:
1:e2652bd064c6
Commit message:
Initial commit

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Tue Jun 26 14:39:21 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#f5776537f27f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 26 14:39:21 2012 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+
+int main() 
+{
+    EthernetInterface eth;
+    eth.init(); //Use DHCP
+
+    eth.connect();
+    
+    TCPSocket sock;
+    sock.connect("mbed.org", 80);
+    
+    const char http_cmd[] = "GET /media/uploads/donatien/hello.txt HTTP/1.1\r\nHost: %s\r\n\r\n";
+    sock.send((std::uint8_t*)http_cmd, sizeof(http_cmd) - 1, 3000);
+
+    char in_buf[256];      
+    bool firstIteration = true;
+    int ret;
+    do
+    {
+        ret = sock.receive((std::uint8_t*)in_buf, 255, firstIteration?3000:0);
+        in_buf[ret] = '\0';
+        
+        printf("Received %d chars from server: %s\n", ret, in_buf);
+        firstIteration = false;
+    } while( ret > 0 );
+      
+    sock.close();  
+    
+    eth.disconnect();  
+
+    while(1) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Jun 26 14:39:21 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#3cf1dd27c89c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 26 14:39:21 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5
\ No newline at end of file