Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 4:24963e7cc783
- Parent:
- 3:f4f66901181c
--- a/main.cpp Tue Aug 08 23:56:11 2017 -0600 +++ b/main.cpp Wed Aug 09 00:34:03 2017 -0600 @@ -30,7 +30,7 @@ printf("Basic HTTP server example\n"); EthernetInterface eth; - eth.set_network("192.168.1.101", "255.255.255.0","192.168.1.1"); + /* eth.set_network("192.168.1.101", "255.255.255.0","192.168.1.1"); */ eth.connect(); printf("The target IP address is '%s'\n", eth.get_ip_address()); @@ -38,8 +38,8 @@ printf("The target gateway is '%s'\n", eth.get_gateway()); TCPServer srv; + TCPSocket clt_sock; SocketAddress clt_addr; - TCPSocket clt_sock; /* Open the server on ethernet stack */ srv.open(ð); @@ -49,15 +49,10 @@ /* Can handle 5 simultaneous connections */ srv.listen(5); + while (true) { srv.accept(&clt_sock, &clt_addr); - while (true) { - wait(1); printf("accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port()); - wait(1); clt_sock.send(HTTP_RESPONSE, strlen(HTTP_RESPONSE)); - wait(1); - clt_sock.send("hi\r\n", strlen("hi\r\n")); - if( swtch == 0 ) clt_sock.send("hi\r\n", strlen("hi\r\n")); - printf("accept %s:%d\n", clt_addr.get_ip_address(), clt_addr.get_port()); + /* clt_sock.send("hi\r\n", strlen("hi\r\n")); */ } }