Documentation for module: Network
Former-commit-id: cb5674c011d3d6895848cab77bb2e4a05e5d9b7b
This commit is contained in:
@@ -6,24 +6,46 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a UdpSocket object by default
|
||||
*/
|
||||
|
||||
inline UdpSocket::UdpSocket() :
|
||||
AbstractSocket(SocketType_UDP)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a UdpSocket object with a net protocol
|
||||
*
|
||||
* \param protocol Net protocol to use
|
||||
*/
|
||||
|
||||
inline UdpSocket::UdpSocket(NetProtocol protocol) :
|
||||
UdpSocket()
|
||||
{
|
||||
Create(protocol);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a UdpSocket object with another one by move semantic
|
||||
*
|
||||
* \param udpSocket UdpSocket to move into this
|
||||
*/
|
||||
|
||||
inline UdpSocket::UdpSocket(UdpSocket&& udpSocket) :
|
||||
AbstractSocket(std::move(udpSocket)),
|
||||
m_boundAddress(std::move(udpSocket.m_boundAddress)),
|
||||
m_state(udpSocket.m_state)
|
||||
m_boundAddress(std::move(udpSocket.m_boundAddress))
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Binds a specific port
|
||||
* \return State of the socket
|
||||
*
|
||||
* \param port Port to bind
|
||||
*/
|
||||
|
||||
inline SocketState UdpSocket::Bind(UInt16 port)
|
||||
{
|
||||
IpAddress any;
|
||||
@@ -47,6 +69,13 @@ namespace Nz
|
||||
return Bind(any);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Creates a UDP socket
|
||||
* \return true If successful
|
||||
*
|
||||
* \param protocol Net protocol to use
|
||||
*/
|
||||
|
||||
bool UdpSocket::Create(NetProtocol protocol)
|
||||
{
|
||||
NazaraAssert(protocol != NetProtocol_Unknown, "Invalid protocol");
|
||||
@@ -54,21 +83,41 @@ namespace Nz
|
||||
return Open(protocol);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the bound address
|
||||
* \return IpAddress we are linked to
|
||||
*/
|
||||
|
||||
inline IpAddress UdpSocket::GetBoundAddress() const
|
||||
{
|
||||
return m_boundAddress;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the port of the bound address
|
||||
* \return Port we are linked to
|
||||
*/
|
||||
|
||||
inline UInt16 UdpSocket::GetBoundPort() const
|
||||
{
|
||||
return m_boundAddress.GetPort();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the state of the socket
|
||||
* \return State of the socket
|
||||
*/
|
||||
|
||||
inline SocketState UdpSocket::GetState() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the broadcasting is enabled
|
||||
* \return true If it is the case
|
||||
*/
|
||||
|
||||
inline bool UdpSocket::IsBroadcastingEnabled() const
|
||||
{
|
||||
return m_isBroadCastingEnabled;
|
||||
|
||||
Reference in New Issue
Block a user