Example program for the BSDInterface
Dependencies: BSDInterface NetworkSocketAPI
Fork of HelloLWIPInterface by
Revision 17:72de842c27b4, committed 2015-07-21
- Comitter:
- sarahmarshy
- Date:
- Tue Jul 21 19:56:29 2015 +0000
- Parent:
- 16:bb0a5b830dc5
- Child:
- 18:a5830a6d3e11
- Commit message:
- Working receive command
Changed in this revision
ESP8266Interface.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ESP8266Interface.lib Fri Jul 17 23:16:57 2015 +0000 +++ b/ESP8266Interface.lib Tue Jul 21 19:56:29 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/NetworkSocketAPI/code/WiFiRadioInterface/#9fc7976c7b27 +http://developer.mbed.org/teams/NetworkSocketAPI/code/WiFiRadioInterface/#783c46b13285
--- 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();