Network/UdpSocket: Add broadcasting option
Former-commit-id: bde428efc5e9c77cf3e64ec04d58d72613f1d8de
This commit is contained in:
@@ -509,6 +509,25 @@ namespace Nz
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SocketImpl::SetBroadcasting(SocketHandle handle, bool broadcasting, SocketError* error)
|
||||
{
|
||||
NazaraAssert(handle != InvalidHandle, "Invalid handle");
|
||||
|
||||
BOOL option = broadcasting;
|
||||
if (setsockopt(handle, SOL_SOCKET, SO_BROADCAST, reinterpret_cast<const char*>(&option), sizeof(option)) == SOCKET_ERROR)
|
||||
{
|
||||
if (error)
|
||||
*error = TranslateWSAErrorToSocketError(WSAGetLastError());
|
||||
|
||||
return false; //< Error
|
||||
}
|
||||
|
||||
if (error)
|
||||
*error = SocketError_NoError;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SocketImpl::SetKeepAlive(SocketHandle handle, bool enabled, UInt64 msTime, UInt64 msInterval, SocketError* error)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user