]> git.tdb.fi Git - libs/net.git/blobdiff - source/streamlistensocket.cpp
Drop Id tags and copyright notices
[libs/net.git] / source / streamlistensocket.cpp
index df80b001f30e1eef9941d4ca70af353145c657b7..88a37bf73fb4f6bc3563788f05714b2c1a36350a 100644 (file)
@@ -1,11 +1,4 @@
-/* $Id$
-
-This file is part of libmspnet
-Copyright © 2008  Mikkosoft Productions, Mikko Rasa
-Distributed under the LGPL
-*/
-
-#include <errno.h>
+#include <cerrno>
 #include <msp/core/refptr.h>
 #include <msp/strings/formatter.h>
 #include "streamlistensocket.h"
@@ -30,7 +23,7 @@ void StreamListenSocket::listen(const SockAddr &addr, unsigned backlog)
 
        int err=::listen(handle, backlog);
        if(err==-1)
-               throw Exception(format("Unable to listen: %s", strerror(errno)));
+               throw SystemError("Unable to listen", errno);
 
 #ifdef WIN32
        WSAEventSelect(handle, event, FD_ACCEPT);
@@ -45,9 +38,9 @@ StreamSocket *StreamListenSocket::accept()
        if(!listening)
                throw InvalidState("Socket is not listening");
 
-       sockaddr sa;
-       socklen_t size=sizeof(sockaddr);
-       SocketHandle new_h=::accept(handle, &sa, &size);
+       sockaddr_storage sa;
+       socklen_t size=sizeof(sockaddr_storage);
+       SocketHandle new_h=::accept(handle, reinterpret_cast<sockaddr *>(&sa), &size);
 
        RefPtr<SockAddr> paddr=SockAddr::create(sa);
        return new StreamSocket(new_h, *paddr);