X-Git-Url: http://git.tdb.fi/?p=libs%2Fnet.git;a=blobdiff_plain;f=source%2Fstreamsocket.cpp;h=0322f12f1c286b63977435e7bb64b151daf0af68;hp=56df99335fb6c0b19f84264e73aa10f94a0ba248;hb=1b2aabf076169e6d2049227188e464e95ac40514;hpb=35009eb3f51a6fd0f9261f892a85d97d81e69886 diff --git a/source/streamsocket.cpp b/source/streamsocket.cpp index 56df993..0322f12 100644 --- a/source/streamsocket.cpp +++ b/source/streamsocket.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of libmspnet -Copyright © 2008-2009 Mikkosoft Productions, Mikko Rasa +Copyright © 2008-2009, 2011 Mikkosoft Productions, Mikko Rasa Distributed under the LGPL */ @@ -102,11 +102,11 @@ int StreamSocket::connect(const SockAddr &addr) if(connected) throw InvalidState("Socket is already connected"); - sockaddr sa; + sockaddr_storage sa; socklen_t size=addr.fill_sockaddr(sa); #ifdef WIN32 - int err=WSAConnect(handle, &sa, size, 0, 0, 0, 0); + int err=WSAConnect(handle, reinterpret_cast(&sa), size, 0, 0, 0, 0); if(err==SOCKET_ERROR) { int err_code=WSAGetLastError(); @@ -120,7 +120,7 @@ int StreamSocket::connect(const SockAddr &addr) throw Exception(format("Unable to connect: %d", err_code)); } #else - int err=::connect(handle, &sa, size); + int err=::connect(handle, reinterpret_cast(&sa), size); if(err==-1) { if(errno==EINPROGRESS) @@ -137,8 +137,8 @@ int StreamSocket::connect(const SockAddr &addr) peer_addr=addr.copy(); delete local_addr; - size=sizeof(sockaddr); - getsockname(handle, &sa, &size); + size=sizeof(sockaddr_storage); + getsockname(handle, reinterpret_cast(&sa), &size); local_addr=SockAddr::create(sa); if(err==0)