Open GoogleCodeExporter opened 9 years ago
I am not sure if it solves your problem but it could.
Assuming pointer size and long size is never good.
Here is a patch for proper handling of gethostbyname() and socket()
diff -ubpB TcpSocket.cpp.org TcpSocket.cpp
--- TcpSocket.cpp.org 2011-03-20 20:47:15.145339711 +0100
+++ TcpSocket.cpp 2011-03-20 20:54:58.965339490 +0100
@@ -240,7 +240,7 @@ TcpSocket :: open ( void )
memset( &addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
- addr.sin_addr.s_addr = *((long*) pHostEntry->h_addr_list[0]);
+
memcpy(&(addr.sin_addr.s_addr),pHostEntry->h_addr_list[0],pHostEntry->h_length);
#endif
if ( (sockfd = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 ) {
Original comment by oetelaar.automatisering
on 20 Mar 2011 at 7:58
Is this confirmed working on all other platforms?
Original comment by rafael2k...@gmail.com
on 16 Jan 2012 at 9:26
Original issue reported on code.google.com by
vex...@gmail.com
on 11 Nov 2010 at 1:45