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.
Dependencies: DnsQuery ESP8266Interface NetworkSocketAPI mbed
Fork of HelloESP8266Interface by
Diff: main.cpp
- Revision:
- 17:72de842c27b4
- Parent:
- 16:bb0a5b830dc5
- Child:
- 18:a5830a6d3e11
diff -r bb0a5b830dc5 -r 72de842c27b4 main.cpp
--- a/main.cpp Fri Jul 17 23:16:57 2015 +0000
+++ b/main.cpp Tue Jul 21 19:56:29 2015 +0000
@@ -28,18 +28,24 @@
wifi.init();
wifi.connect("Buffalo-G-1280", "13808136");
- SocketInterface* myUDPSocket = wifi.allocateSocket(SOCK_UDP);
+ //char* ip;
+ //ip = wifi.getIPAddress();
+ //if(!(ip==NULL))
+ //printf("IP Address is: %s",ip);
- myUDPSocket->setAddressPort("192.168.13.5", 7);
+ SocketInterface* mySocket = wifi.allocateSocket(SOCK_TCP);
- myUDPSocket->open();
- myUDPSocket->send("Hello",5, 10000);
+ mySocket->setAddressPort("192.168.13.3", 7);
+
+ mySocket->open();
+ mySocket->send("Hello",5, 10000);
char recieved[100];
int recv_amnt = 0;
- recv_amnt = myUDPSocket->recv(recieved, 5, 10000);
+ recieved[5] = 0;
+ recv_amnt = mySocket->recv(recieved, 5, 10000);
printf("Recieved: %d, %s\n",recv_amnt,recieved);
- myUDPSocket->close();
+ mySocket->close();
wifi.disconnect();
