From ec2ecbd35bea64c88ab783b06100edc65c418048 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 23 Sep 2001 22:10:43 +0000 Subject: Some IRC features... --- lib/Socket.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/Socket.cc') 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 #include #include +#include #include #include #include @@ -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; -- cgit v1.2.3