Simple TCP/IP Server (dynamic web page)

Dependents:   TASKHTML

Revision:
2:ecf4c78019ab
Parent:
1:76bd6f78cabc
Child:
3:265121e8c2cc
diff -r 76bd6f78cabc -r ecf4c78019ab main.cpp
--- a/main.cpp	Tue Nov 21 14:21:48 2017 +0000
+++ b/main.cpp	Fri Nov 08 14:22:35 2019 +0000
@@ -1,7 +1,3 @@
-#if !FEATURE_LWIP
-    #error [NOT_SUPPORTED] LWIP not supported for this target
-#endif
-
 #include "mbed.h"
 #include "EthernetInterface.h"
 #include "TCPServer.h"
@@ -47,7 +43,7 @@
     printf("The target IP address is '%s'\n", eth.get_ip_address());
     
     //Now setup a web server
-    TCPServer srv;           //TCP/IP Server
+    TCPSocket srv;           //TCP/IP Server
     TCPSocket clt_sock;      //Socket for communication
     SocketAddress clt_addr;  //Address of incoming connection
     
@@ -63,7 +59,7 @@
     while (true) {
         using namespace std;
         //Block and wait on an incoming connection
-        srv.accept(&clt_sock, &clt_addr);
+        srv.accept();
         printf("accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port());
         
         //Uses a C++ string to make it easier to concatinate