ap

Dependencies:   DnsQuery

Dependents:   WizFi310_TCP_Echo_Server_Example

Fork of NetworkSocketAPI by NetworkSocketAPI

Branch:
api-changes
Revision:
31:7f15b95f2a1d
Parent:
30:3cc78f5db99d
Child:
32:2c5fc105fc50
--- a/Socket.cpp	Mon Feb 22 21:03:38 2016 +0000
+++ b/Socket.cpp	Mon Feb 22 22:51:03 2016 +0000
@@ -56,8 +56,12 @@
     SocketInterface *s = _get_socket();
     if (!s) return -2;
 
-    int32_t error = s->setURL(url);
-    if (error < 0) return error;
+    int32_t err = _iface->getHostByName(url, _ip_address);
+    if (err < 0) return err;
+
+    if (_socket) {
+        _socket->setIPAddress(_ip_address);
+    }
 
     if (port) {
         setPort(port);
@@ -71,7 +75,7 @@
     strcpy(_ip_address, ip);
 
     if (_socket) {
-        _socket->setIPAddress(ip);
+        _socket->setIPAddress(_ip_address);
     }
 
     if (port) {
@@ -84,7 +88,7 @@
     _port = port;
 
     if (_socket) {
-        _socket->setPort(port);
+        _socket->setPort(_port);
     }
 }