X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstreamlistensocket.cpp;h=12e98b1f6a2d3b9d40fca5f689f74e2af07a7630;hb=a4f75be32827b00d9de9d8a68855fec2f5157a10;hp=df80b001f30e1eef9941d4ca70af353145c657b7;hpb=f59eded7c3e162bbdfc6db424c9badc730017698;p=libs%2Fnet.git diff --git a/source/streamlistensocket.cpp b/source/streamlistensocket.cpp index df80b00..12e98b1 100644 --- a/source/streamlistensocket.cpp +++ b/source/streamlistensocket.cpp @@ -1,11 +1,11 @@ /* $Id$ This file is part of libmspnet -Copyright © 2008 Mikkosoft Productions, Mikko Rasa +Copyright © 2008, 2011 Mikkosoft Productions, Mikko Rasa Distributed under the LGPL */ -#include +#include #include #include #include "streamlistensocket.h" @@ -30,7 +30,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 +45,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(&sa), &size); RefPtr paddr=SockAddr::create(sa); return new StreamSocket(new_h, *paddr);