#include <cerrno>
#include <msp/core/refptr.h>
+#include <msp/core/systemerror.h>
#include <msp/strings/format.h>
#include "streamlistensocket.h"
#include "streamsocket.h"
+using namespace std;
+
namespace Msp {
namespace Net {
int StreamListenSocket::connect(const SockAddr &)
{
- throw Exception("Can't connect a listen socket");
+ // XXX This function needs to go away
+ throw logic_error("Can't connect a listen socket");
}
void StreamListenSocket::listen(const SockAddr &addr, unsigned backlog)
int err = ::listen(handle, backlog);
if(err==-1)
- throw SystemError("Unable to listen", errno);
+ throw system_error("listen");
#ifdef WIN32
WSAEventSelect(handle, event, FD_ACCEPT);
StreamSocket *StreamListenSocket::accept()
{
if(!listening)
- throw InvalidState("Socket is not listening");
+ throw bad_socket_state("not listening");
sockaddr_storage sa;
socklen_t size = sizeof(sockaddr_storage);