demo versie 16/05

Dependencies:   EthernetInterface mbed-rto mbed

Fork of ProjectVLC by Klaas Govaerts

Revision:
37:4589f962697d
Parent:
36:aa6c6c177be2
Child:
41:b39239c02c95
diff -r aa6c6c177be2 -r 4589f962697d TCPlistener.cpp
--- a/TCPlistener.cpp	Wed May 02 08:11:42 2018 +0000
+++ b/TCPlistener.cpp	Wed May 02 08:48:33 2018 +0000
@@ -12,12 +12,12 @@
     eth.connect();
     server.bind(4000);
     server.listen();
-    server.set_blocking(false,0);
+    server.set_blocking(true);
     //arraySize=10;
 }
 
 /**
-* Receives all packets sent to 192.168.0.253:4000. The receive is non blocking.
+* Receives all packets sent to 192.168.0.253:4000. The receive is blocking.
 * @param contents The location where the segment contents will be written, formatted as null terminated character array.
 * @param size The max size of the "contents" array.
 * @return True if a segment was received, false if no segment was received.
@@ -27,13 +27,10 @@
     TCPSocketConnection client;
     server.accept(client);
     int n=client.receive(contents,size);
-    while(n==-1)
-    {   
-        if(n!=-1){
-            contents[n] = '\0';
-            printf("Segment ontvangen van %s:%i met inhoud \"%s\"\r\n", client.get_address(),client.get_port(),contents);
-            return true;
-        }
-    }    
+    if(n!=-1){
+        contents[n] = '\0';
+        printf("Segment ontvangen van %s:%i met inhoud \"%s\"\r\n", client.get_address(),client.get_port(),contents);
+        return true;
+    }
     return false;
 }
\ No newline at end of file