cc3000 hostdriver with the mbed socket interface
Fork of cc3000_hostdriver_mbedsocket by
Diff: Socket/Endpoint.cpp
- Revision:
- 8:4c42ca37ba33
- Parent:
- 5:245ac5b73132
- Child:
- 9:4d12b82bc767
--- 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),