summaryrefslogtreecommitdiff
path: root/server/src/tcpsocket.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/tcpsocket.cc')
-rw-r--r--server/src/tcpsocket.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc
index d361b7b..4bb7a4b 100644
--- a/server/src/tcpsocket.cc
+++ b/server/src/tcpsocket.cc
@@ -28,8 +28,6 @@
#include "debug.h"
-#include "tostring.h"
-
// for gethostbyname
#include <netdb.h>
@@ -170,7 +168,9 @@ void TCPSocket::connect(std::string addr, unsigned short int port)
struct hostent *he;
he = gethostbyname(addr.c_str());
if(!he || !he->h_length) {
- throw TCPConnectException(addr, toString(port),
+ char portno[32];
+ sprintf(portno, "%d", port);
+ throw TCPConnectException(addr, portno,
std::string("host lookup failed: ") + hstrerror(h_errno));
}
@@ -188,7 +188,9 @@ void TCPSocket::connect(std::string addr, unsigned short int port)
socketaddr.sin_addr.s_addr = inet_addr(ip);
if(_connect(sock, (struct sockaddr*)&socketaddr, sizeof(socketaddr))) {
- throw TCPConnectException(addr, toString(port), hstrerror(h_errno));
+ char portno[32];
+ sprintf(portno, "%d", port);
+ throw TCPConnectException(addr, portno, hstrerror(h_errno));
}
isconnected = true;