cc3000 hostdriver with the mbed socket interface
Dependents: cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more
Revision 8:4c42ca37ba33, committed 2013-09-30
- Comitter:
- Kojto
- Date:
- Mon Sep 30 19:29:06 2013 +0000
- Parent:
- 7:99b75a51e168
- Child:
- 9:4d12b82bc767
- Commit message:
- Endpoint::set_address correction with IP returned from gethostbyname; Socket - sock_fd set to -1 when socket is closed (still not handling return type. Will add later)
Changed in this revision
Socket/Endpoint.cpp | Show annotated file Show diff for this revision Revisions of this file |
Socket/Socket.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Socket/Endpoint.cpp Thu Sep 26 20:03:30 2013 +0000 +++ b/Socket/Endpoint.cpp Mon Sep 30 19:29:06 2013 +0000 @@ -95,7 +95,12 @@ uint32_t address_integer; _cc3000_module->_socket.get_host_by_name((uint8_t *)host, strlen(host) , &address_integer); - _remote_host.sin_addr.s_addr = address_integer; + uint32_t ip = 0; + ip = (ip | (address_integer >> 24)); + ip = (ip | ((address_integer & 0x00FF0000) >> 8)); + ip = (ip | ((address_integer & 0x0000FF00) << 8)); + ip = (ip | ((address_integer & 0x000000FF) << 24)); + _remote_host.sin_addr.s_addr = ip; inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress)); } else { std::memcpy((char*)&_remote_host.sin_addr.s_addr, p_address, 4); @@ -105,7 +110,7 @@ _remote_host.sin_port = htons(port); #if (CC3000_DEBUG == 1) - printf("DEBUG: remote host address (string): %s\n",_ipAddress); + printf("DEBUG: remote host address (string): %s\n",get_address()); printf("DEBUG: remote host address from s_addr : %d.%d.%d.%d\n", int(_remote_host.sin_addr.s_addr & 0xFF), int((_remote_host.sin_addr.s_addr & 0xFF00) >> 8),
--- a/Socket/Socket.cpp Thu Sep 26 20:03:30 2013 +0000 +++ b/Socket/Socket.cpp Mon Sep 30 19:29:06 2013 +0000 @@ -101,6 +101,7 @@ } _cc3000_module->_socket.closesocket(_sock_fd); + _sock_fd = -1; return 0; }