Newtork/AbstractSocket: Allow to specify receive and send buffer size per socket

This commit is contained in:
DrLynix
2017-01-20 14:33:05 +01:00
parent 18862fd1ba
commit 85f0208690
6 changed files with 222 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2017 Jérôme Leclercq
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
@@ -111,6 +111,52 @@ namespace Nz
return SocketImpl::QueryAvailableBytes(m_handle);
}
/*!
* \brief Queries the maximum socket receive buffer size
* \return The size of the receive buffer in bytes.
*/
std::size_t AbstractSocket::QueryReceiveBufferSize() const
{
if (m_handle == SocketImpl::InvalidHandle)
return 0;
return SocketImpl::QueryReceiveBufferSize(m_handle);
}
/*!
* \brief Queries the maximum socket send buffer size
* \return The size of the send buffer in bytes.
*/
std::size_t AbstractSocket::QuerySendBufferSize() const
{
if (m_handle == SocketImpl::InvalidHandle)
return 0;
return SocketImpl::QuerySendBufferSize(m_handle);
}
/*!
* \brief Sets the maximum receive buffer size
*
* \param size The new maximum receive buffer size in bytes
*/
void AbstractSocket::SetReceiveBufferSize(std::size_t size)
{
if (m_handle != SocketImpl::InvalidHandle)
SocketImpl::SetReceiveBufferSize(m_handle, size);
}
/*!
* \brief Sets the maximum send buffer size
*
* \param size The new maximum send buffer size in bytes
*/
void AbstractSocket::SetSendBufferSize(std::size_t size)
{
if (m_handle != SocketImpl::InvalidHandle)
SocketImpl::SetSendBufferSize(m_handle, size);
}
/*!
* \brief Operation to do when closing socket
*/