Simple TCP/IP Server (static web page_
Diff: main.cpp
- Revision:
- 2:31688a1ac73a
- Parent:
- 0:5552cdb52638
- Child:
- 3:c62ab6a06986
--- a/main.cpp Thu Nov 23 14:16:06 2017 +0000
+++ b/main.cpp Fri Nov 08 14:19:22 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"
@@ -40,7 +36,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
@@ -55,7 +51,7 @@
while (true) {
//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());
//Send static HTML response