aboutsummaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/socket.cpp29
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,