TCP echo client from mbed to pc (as server)

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of TCPEchoClient by mbed official

Files at this revision

API Documentation at this revision

Comitter:
MohamadNazrin
Date:
Tue Feb 20 05:09:39 2018 +0000
Parent:
10:0468b439a484
Commit message:
TCP echo client from mbed to pc

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0468b439a484 -r a134fd8cbe67 main.cpp
--- a/main.cpp	Tue Feb 14 16:37:18 2017 +0000
+++ b/main.cpp	Tue Feb 20 05:09:39 2018 +0000
@@ -1,12 +1,15 @@
 #include "mbed.h"
 #include "EthernetInterface.h"
 
-const char* ECHO_SERVER_ADDRESS = "192.168.2.2";
+const char* ECHO_SERVER_ADDRESS = "192.168.137.1";
 const int ECHO_SERVER_PORT = 7;
-
+static const char*          mbedIp       = "192.168.137.2";  //IP
+static const char*          mbedMask     = "255.255.255.0";  // Mask
+static const char*          mbedGateway  = "192.168.137.1";    //Gateway
 int main() {
     EthernetInterface eth;
-    eth.init(); //Use DHCP
+     eth.init(mbedIp,mbedMask,mbedGateway); 
+    //eth.init(); //Use DHCP
     eth.connect();
     printf("\nClient IP Address is %s\n", eth.getIPAddress());