diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-01-14 20:16:15 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-14 20:16:15 +0000 |
commit | e5cfc6a4889f9ca486b07d3be870adbe37b7470d (patch) | |
tree | b30430780fe16689c932f3303bba3175927ad043 | |
parent | cad9cf61c1e1c594f69d7e3feb7413caad3bc047 (diff) | |
download | libbu++-e5cfc6a4889f9ca486b07d3be870adbe37b7470d.tar.gz libbu++-e5cfc6a4889f9ca486b07d3be870adbe37b7470d.tar.bz2 libbu++-e5cfc6a4889f9ca486b07d3be870adbe37b7470d.tar.xz libbu++-e5cfc6a4889f9ca486b07d3be870adbe37b7470d.zip |
More debugging.
-rw-r--r-- | src/socket.cpp | 29 |
1 files 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 ) | |||
82 | char ibuf[10]; | 82 | char ibuf[10]; |
83 | sprintf( ibuf, "%d", nPort ); | 83 | sprintf( ibuf, "%d", nPort ); |
84 | 84 | ||
85 | if( DYNLOAD getaddrinfo( sAddr.getStr(), ibuf, &aiHints, &pAddr ) | 85 | if( int ret = DYNLOAD getaddrinfo( sAddr.getStr(), ibuf, &aiHints, &pAddr ) |
86 | != 0 ) | 86 | != 0 ) |
87 | { | 87 | { |
88 | throw Bu::SocketException("Couldn't resolve hostname %s (%s).\n", | 88 | |
89 | struct addrinfo *pCur = pAddr; | ||
90 | while( pCur ) | ||
91 | { | ||
92 | printf("Name: %s\n", pCur->ai_canonname ); | ||
93 | printf(" Flags: %d\n", pCur->ai_flags ); | ||
94 | printf(" Family: %d\n", pCur->ai_family ); | ||
95 | printf(" Socktype: %d\n", pCur->ai_socktype ); | ||
96 | printf(" Protocol: %d\n", pCur->ai_protocol ); | ||
97 | |||
98 | pCur = pCur->ai_next; | ||
99 | } | ||
100 | throw Bu::SocketException("%d: Couldn't resolve hostname %s (%s).\n", | ||
101 | ret, | ||
89 | sAddr.getStr(), strerror(errno)); | 102 | sAddr.getStr(), strerror(errno)); |
90 | } | 103 | } |
91 | 104 | ||
105 | struct addrinfo *pCur = pAddr; | ||
106 | while( pCur ) | ||
107 | { | ||
108 | printf("Name: %s\n", pCur->ai_canonname ); | ||
109 | printf(" Flags: %d\n", pCur->ai_flags ); | ||
110 | printf(" Family: %d\n", pCur->ai_family ); | ||
111 | printf(" Socktype: %d\n", pCur->ai_socktype ); | ||
112 | printf(" Protocol: %d\n", pCur->ai_protocol ); | ||
113 | |||
114 | pCur = pCur->ai_next; | ||
115 | } | ||
116 | |||
92 | DYNLOAD connect( | 117 | DYNLOAD connect( |
93 | nSocket, | 118 | nSocket, |
94 | pAddr->ai_addr, | 119 | pAddr->ai_addr, |