TCPEchoClient-WIZwiki-W7500
Dependencies: WIZnetInterface mbed DDNS_NoIP
Revision 2:a89cac7c1a3b, committed 2016-01-25
- Comitter:
- Ricky_Kwon
- Date:
- Mon Jan 25 05:11:43 2016 +0000
- Parent:
- 1:86be81112448
- Commit message:
- Wizwiki-W7500 DDNS
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DDNS_NoIP.lib Mon Jan 25 05:11:43 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/WIZnet/code/DDNS_NoIP/#a5d5ddadd7e7
--- a/WIZnetInterface.lib Tue Aug 18 07:00:13 2015 +0000 +++ b/WIZnetInterface.lib Mon Jan 25 05:11:43 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/WIZnet/code/WIZnetInterface/#bda61525ac71 +http://developer.mbed.org/teams/WIZnet/code/WIZnetInterface/#3b64df29662f
--- a/main.cpp Tue Aug 18 07:00:13 2015 +0000 +++ b/main.cpp Mon Jan 25 05:11:43 2016 +0000 @@ -1,44 +1,36 @@ #include "mbed.h" #include "EthernetInterface.h" +#include "DDNSClient.h" uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x12, 0x34, 0x45}; -const char ip_addr[] = "192.168.0.123"; -const char mask_addr[] = "255.255.255.0"; -const char gateway_addr[] = "192.168.0.1"; +//const char ip_addr[] = "192.168.0.123"; +//const char mask_addr[] = "255.255.255.0"; +//const char gateway_addr[] = "192.168.0.1"; + -const char* ECHO_SERVER_ADDRESS = "192.168.0.230"; -const int ECHO_SERVER_PORT = 7; int main (void) { - char buf[256]; + char buf[1024]; + int n=0; printf("Wait a second...\r\n"); EthernetInterface eth; - eth.init(mac_addr, ip_addr, mask_addr, gateway_addr); //Use Static + //eth.init(mac_addr, ip_addr, mask_addr, gateway_addr); //Use Static + eth.init(mac_addr); //Use Dynamic eth.connect(); - - // Connect to Server - TCPSocketConnection socket; + printf("WIZwiki-W7500 IP Address is %s\r\n", eth.getIPAddress()); + + DDNSClient noip; - while (socket.connect(ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT) < 0) { - printf("Unable to connect to (%s) on port (%d)\r\n", ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT); - wait(1); - } - printf("Connected to Server at %s\n",ECHO_SERVER_ADDRESS); + noip.checkIp(); - // Send message to server - char hello[] = "Hello World"; - printf("Sending message to Server : '%s' \r\n",hello); - socket.send_all(hello, sizeof(hello) - 1); + noip.userSetNoIP("cmlja3kwODQ6cmlja3kxMjM=", "ricky084.ddns.net"); + + noip.updateNoIP(); while(true) { - memset(buf, 0, sizeof(buf)); - // Receive message from server - int n = socket.receive(buf, 256); - buf[n] = '\0'; - socket.send(buf, sizeof(buf)); - printf("Received message from server: '%s' \r\n", buf); - printf("Sended message to server: '%s' \r\n", buf); + } } +
--- a/mbed.bld Tue Aug 18 07:00:13 2015 +0000 +++ b/mbed.bld Mon Jan 25 05:11:43 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/da0ca467f8b5 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c \ No newline at end of file