summaryrefslogtreecommitdiff
path: root/lib/Socket.cc
diff options
context:
space:
mode:
authorPixel <Pixel>2001-09-23 22:10:43 +0000
committerPixel <Pixel>2001-09-23 22:10:43 +0000
commitec2ecbd35bea64c88ab783b06100edc65c418048 (patch)
treef270dc1a013c3fe26170e63bc2be8d8a3ca936d0 /lib/Socket.cc
parent76fde1f5b754845bd9b40cf9b2f15734686f6d09 (diff)
Some IRC features...
Diffstat (limited to 'lib/Socket.cc')
-rw-r--r--lib/Socket.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Socket.cc b/lib/Socket.cc
index 100d434..de6f42e 100644
--- a/lib/Socket.cc
+++ b/lib/Socket.cc
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <errno.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
@@ -104,6 +105,7 @@ bool Socket::Connect(String host, int port) {
struct sockaddr_in remotesocketaddr;
if (!listening && !connected) {
+ cerr << " - Resolving '" << host << "'..." << endl;
if (!(remotehostent = gethostbyname(host.to_charp()))) {
return false;
}
@@ -111,8 +113,12 @@ bool Socket::Connect(String host, int port) {
remotesocketaddr.sin_family = AF_INET;
remotesocketaddr.sin_port = htons(port);
bcopy(remotehostent->h_addr, &remotesocketaddr.sin_addr, remotehostent->h_length);
- if(connect(GetHandle(), (struct sockaddr *)&remotesocketaddr, sizeof(remotesocketaddr)) < 0) {
+ cerr << " - Connecting to port " << port << " ..." << endl;
+ if (!connect(GetHandle(), (struct sockaddr *)&remotesocketaddr, sizeof(remotesocketaddr))) {
+ cerr << " - Connected." << endl;
connected = true;
+ } else {
+ cerr << " - Error connecting: " << strerror(errno) << endl;
}
}
return connected;