X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsocket.cpp;h=dd6c526e994fdeb9dd5fc12da0ce9c9822608793;hb=2aab4004e71a2e5c773289e0be5e58aec6a8d339;hp=49614df0c807bdf89f3d5772b3afb996b1bf0039;hpb=35009eb3f51a6fd0f9261f892a85d97d81e69886;p=libs%2Fnet.git diff --git a/source/socket.cpp b/source/socket.cpp index 49614df..dd6c526 100644 --- a/source/socket.cpp +++ b/source/socket.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspnet -Copyright © 2008 Mikkosoft Productions, Mikko Rasa -Distributed under the LGPL -*/ - #ifndef WIN32 #include #include @@ -49,9 +42,9 @@ Socket::Socket(SocketHandle h, const SockAddr &paddr): local_addr(0), peer_addr(paddr.copy()) { - sockaddr sa; - socklen_t size=sizeof(sockaddr); - getsockname(handle, &sa, &size); + sockaddr_storage sa; + socklen_t size=sizeof(sockaddr_storage); + getsockname(handle, reinterpret_cast(&sa), &size); local_addr=SockAddr::create(sa); #ifdef WIN32 @@ -105,10 +98,10 @@ void Socket::bind(const SockAddr &addr) { check_state(false); - sockaddr sa; + sockaddr_storage sa; unsigned size=addr.fill_sockaddr(sa); - int err=::bind(handle, &sa, size); + int err=::bind(handle, reinterpret_cast(&sa), size); if(err==-1) throw SystemError("Unable to bind", errno);