TCPSocket_Ethernet modify
Dependencies: EthernetInterface2 mbed-rtos mbed
Fork of TCPSocket_HelloWorld by
Revision 15:d7e821422e97, committed 2017-05-30
- Comitter:
- artpes
- Date:
- Tue May 30 16:07:41 2017 +0000
- Parent:
- 14:72be2b8b7f24
- Commit message:
- Tcp socket ethernet
Changed in this revision
diff -r 72be2b8b7f24 -r d7e821422e97 EthernetInterface.lib --- a/EthernetInterface.lib Wed May 14 15:07:26 2014 +0000 +++ b/EthernetInterface.lib Tue May 30 16:07:41 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#097a9996f8d5 +https://developer.mbed.org/users/artpes/code/EthernetInterface2/#e6169b720891
diff -r 72be2b8b7f24 -r d7e821422e97 main.cpp --- a/main.cpp Wed May 14 15:07:26 2014 +0000 +++ b/main.cpp Tue May 30 16:07:41 2017 +0000 @@ -1,16 +1,19 @@ #include "mbed.h" #include "EthernetInterface.h" +Serial pc(USBTX, USBRX); + int main() { EthernetInterface eth; eth.init(); //Use DHCP - eth.connect(); - printf("IP Address is %s\n", eth.getIPAddress()); + int i = eth.connect(); + pc.printf("Connection = %d, ",i); + pc.printf("\nIP Address is %s -\nGateway: %s -\nMACAddress %s \n", eth.getIPAddress(),eth.getGateway(),eth.getMACAddress()); TCPSocketConnection sock; - sock.connect("mbed.org", 80); + sock.connect("www.unife.it", 80); - char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; + char http_cmd[] = "GET /ing/lm.infoauto HTTP/1.0\n\n"; sock.send_all(http_cmd, sizeof(http_cmd)-1); char buffer[300]; @@ -20,7 +23,7 @@ if (ret <= 0) break; buffer[ret] = '\0'; - printf("Received %d chars from server:\n%s\n", ret, buffer); + pc.printf("Received %d chars from server:\n%s\n", ret, buffer); } sock.close();
diff -r 72be2b8b7f24 -r d7e821422e97 mbed-rtos.lib --- a/mbed-rtos.lib Wed May 14 15:07:26 2014 +0000 +++ b/mbed-rtos.lib Tue May 30 16:07:41 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d +http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
diff -r 72be2b8b7f24 -r d7e821422e97 mbed.bld --- a/mbed.bld Wed May 14 15:07:26 2014 +0000 +++ b/mbed.bld Tue May 30 16:07:41 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file +https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b \ No newline at end of file