UDP echo with thread

Revision:
4:2579ef3b025f
Parent:
3:9ab431fc54e2
Child:
5:58fe518111d7
--- a/main.cpp	Fri May 08 12:03:27 2020 +0000
+++ b/main.cpp	Fri May 08 18:33:18 2020 +0000
@@ -3,11 +3,11 @@
 
 #define ROUTER
 #ifndef ROUTER
-    #define IP          "192.168.1.1"   //Here place your defined IP of Mbed
+    #define IP          "192.168.1.1"   //Here place your Static IP of Mbed, when you want it to connect directly to PC
     #define GATEWAY     "0.0.0.0"
     #define MASK        "255.255.255.0"
 #endif
-#define ADDRESS         "10.0.1.29"     //Here place IP of your PC. Run cmd.exe and write command ipconfig
+#define ADDRESS         "192.168.1.10"     //Here place IP of your PC. Run cmd.exe and write command ipconfig
 #define LOCALPORT         20
 #define REMOTEPORT      2000
 
@@ -21,7 +21,7 @@
     int eth_stat;
 #ifndef ROUTER
     eth.disconnect();
-    eth_stat = eth.set_network(IP,MASK,GATEWAY);
+    eth_stat = eth.set_network((SocketAddress)IP,(SocketAddress)MASK,(SocketAddress)GATEWAY);
     printf("set IP status: %i\n",eth_stat);
 #endif
     eth_stat = eth.connect();
@@ -41,11 +41,12 @@
     printf("Gateway: %s\n", p_gateway ? p_gateway : "None");
 
     // Check ip
-    if(ip){// Check ip
+    if(ip){
         UDPSocket sock; 
         SocketAddress addr;
         sock.open(&eth);
         sock.bind(LOCALPORT);
+        
         printf("Listen on local port: %d and send to remote port %d\n", LOCALPORT, REMOTEPORT);
         char buffer[] = "Hello World, UDP Echo"; 
         printf("Sending message '%s' to (%s)\n",buffer,targetAddr.get_ip_address());