From e5cfc6a4889f9ca486b07d3be870adbe37b7470d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 14 Jan 2009 20:16:15 +0000 Subject: More debugging. --- src/socket.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/socket.cpp b/src/socket.cpp index 53b6522..bd60540 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -82,13 +82,38 @@ Bu::Socket::Socket( const Bu::FString &sAddr, int nPort, int nTimeout ) char ibuf[10]; sprintf( ibuf, "%d", nPort ); - if( DYNLOAD getaddrinfo( sAddr.getStr(), ibuf, &aiHints, &pAddr ) + if( int ret = DYNLOAD getaddrinfo( sAddr.getStr(), ibuf, &aiHints, &pAddr ) != 0 ) { - throw Bu::SocketException("Couldn't resolve hostname %s (%s).\n", + + struct addrinfo *pCur = pAddr; + while( pCur ) + { + printf("Name: %s\n", pCur->ai_canonname ); + printf(" Flags: %d\n", pCur->ai_flags ); + printf(" Family: %d\n", pCur->ai_family ); + printf(" Socktype: %d\n", pCur->ai_socktype ); + printf(" Protocol: %d\n", pCur->ai_protocol ); + + pCur = pCur->ai_next; + } + throw Bu::SocketException("%d: Couldn't resolve hostname %s (%s).\n", + ret, sAddr.getStr(), strerror(errno)); } + struct addrinfo *pCur = pAddr; + while( pCur ) + { + printf("Name: %s\n", pCur->ai_canonname ); + printf(" Flags: %d\n", pCur->ai_flags ); + printf(" Family: %d\n", pCur->ai_family ); + printf(" Socktype: %d\n", pCur->ai_socktype ); + printf(" Protocol: %d\n", pCur->ai_protocol ); + + pCur = pCur->ai_next; + } + DYNLOAD connect( nSocket, pAddr->ai_addr, -- cgit v1.2.3