Add wxSocketBase::GetSocket().

Provide direct access to the underlying socket descriptor.

Closes #8829.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-04-22 10:45:30 +00:00
parent 98a177f45a
commit 0623b0f001
5 changed files with 56 additions and 9 deletions

View File

@@ -526,7 +526,7 @@ wxSocketImpl *wxSocketImpl::Accept(wxSocketBase& wxsocket)
{
wxSockAddressStorage from;
WX_SOCKLEN_T fromlen = sizeof(from);
const SOCKET fd = accept(m_fd, &from.addr, &fromlen);
const wxSOCKET_T fd = accept(m_fd, &from.addr, &fromlen);
// accepting is similar to reading in the sense that it resets "ready for
// read" flag on the socket
@@ -1826,9 +1826,9 @@ wxSocketServer::wxSocketServer(const wxSockAddress& addr,
return;
}
// Notice that we need a cast as SOCKET is 64 bit under Win64 and that the
// cast is safe because a SOCKET is a handle and so limited to 32 (or,
// actually, even 24) bit values anyhow.
// Notice that we need a cast as wxSOCKET_T is 64 bit under Win64 and that
// the cast is safe because a wxSOCKET_T is a handle and so limited to 32
// (or, actually, even 24) bit values anyhow.
wxLogTrace( wxTRACE_Socket, wxT("wxSocketServer on fd %u"),
static_cast<unsigned>(m_impl->m_fd) );
}
@@ -1894,6 +1894,14 @@ bool wxSocketServer::WaitForAccept(long seconds, long milliseconds)
return DoWait(seconds, milliseconds, wxSOCKET_CONNECTION_FLAG) == 1;
}
wxSOCKET_T wxSocketBase::GetSocket() const
{
wxASSERT_MSG( m_impl, wxS("Socket not initialised") );
return m_impl->m_fd;
}
bool wxSocketBase::GetOption(int level, int optname, void *optval, int *optlen)
{
wxASSERT_MSG( m_impl, wxT("Socket not initialised") );