aboutsummaryrefslogtreecommitdiffstats
path: root/src/platforms/posix/posixSocket.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-01-04 22:03:16 +0000
committerVincent Richard <[email protected]>2005-01-04 22:03:16 +0000
commit3b97064d40e93c26bdf895c52bedb2f58dda0406 (patch)
tree517bd37ecea5c668620db1696f60ad2c45d95b10 /src/platforms/posix/posixSocket.cpp
parentFixed a linking error with g++ <= 3.2. (diff)
downloadvmime-3b97064d40e93c26bdf895c52bedb2f58dda0406.tar.gz
vmime-3b97064d40e93c26bdf895c52bedb2f58dda0406.zip
Added diagnostic error string for 'exceptions::connection_error' + fixed a bug in 'posixSocket::connect()' when specifying an IP address.
Diffstat (limited to 'src/platforms/posix/posixSocket.cpp')
-rw-r--r--src/platforms/posix/posixSocket.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
index 0318e553..39acf666 100644
--- a/src/platforms/posix/posixSocket.cpp
+++ b/src/platforms/posix/posixSocket.cpp
@@ -80,22 +80,17 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port
if (hostInfo == NULL)
{
// Error: cannot resolve address
- throw vmime::exceptions::connection_error();
+ throw vmime::exceptions::connection_error("Cannot resolve address.");
}
bcopy(hostInfo->h_addr, reinterpret_cast <char*>(&addr.sin_addr), hostInfo->h_length);
}
- else
- {
- // Error: cannot resolve address
- throw vmime::exceptions::connection_error();
- }
// Get a new socket
m_desc = ::socket(AF_INET, SOCK_STREAM, 0);
if (m_desc == -1)
- throw vmime::exceptions::connection_error();
+ throw vmime::exceptions::connection_error("Error while creating socket.");
// Start connection
if (::connect(m_desc, reinterpret_cast <sockaddr*>(&addr), sizeof(addr)) == -1)
@@ -104,7 +99,7 @@ void posixSocket::connect(const vmime::string& address, const vmime::port_t port
m_desc = -1;
// Error
- throw vmime::exceptions::connection_error();
+ throw vmime::exceptions::connection_error("Error while connecting socket.");
}
}