WIZ820io(W5200) network interface, EthernetInterface compatible.

Dependents:   Seeed_Ethernet_Shield_V2_HelloWorld Seeed_Ethernet_Shield Cayenne-WIZ820ioInterface Seeed_Ethernet_Shield

Fork of WiflyInterface by mbed official

WIZ820io

Revision:
5:fb15c35d1e28
Parent:
1:fb4494783863
--- a/Socket/Endpoint.cpp	Thu Dec 20 15:08:58 2012 +0000
+++ b/Socket/Endpoint.cpp	Tue Aug 27 12:50:11 2013 +0000
@@ -17,14 +17,8 @@
  */
 #include "Socket/Socket.h"
 #include "Socket/Endpoint.h"
-#include <cstring>
-
-using std::memset;
 
 Endpoint::Endpoint()  {
-    wifly = Wifly::getInstance();
-    if (wifly == NULL)
-        error("Endpoint constructor error: no wifly instance available!\r\n");
     reset_address();
 }
 Endpoint::~Endpoint() {}
@@ -36,7 +30,15 @@
 
 int Endpoint::set_address(const char* host, const int port) {
     //Resolve DNS address or populate hard-coded IP address
-    wifly->gethostbyname(host, _ipAddress);
+    WIZ820io* eth = WIZ820io::getInstance();
+    if (eth == NULL) {
+        return -1;
+    }
+    uint32_t addr;
+    if (!eth->gethostbyname(host, &addr)) {
+        return -1;
+    }
+    snprintf(_ipAddress, sizeof(_ipAddress), "%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8)&0xff, addr&0xff);
     _port = port;
     return 0;
 }