cmUdpPort.h/c: Added kBroadcastUdpFl option.

This commit is contained in:
kpl 2013-04-27 15:51:58 -07:00
parent 44900567b8
commit 76258fe7e2
2 changed files with 14 additions and 1 deletions

View File

@ -256,6 +256,18 @@ cmUdpRC_t cmUdpInit(
}
// if broadcast option was requested.
if( cmIsFlag(flags,kBroadcastUdpFl) )
{
int bcastFl = 1;
if( setsockopt( p->sockH, SOL_SOCKET, SO_BROADCAST, &bcastFl, sizeof(bcastFl) ) == cmUdp_SYS_ERR )
{
rc = cmErrSysMsg(&p->err,kSockOptSetFailUdpRC,errno, "Attempt to set the socket broadcast attribute failed." );
goto errLabel;
}
}
if( recvBufByteCnt != 0 )
p->tempBuf = cmMemAlloc(char,recvBufByteCnt );

View File

@ -41,7 +41,8 @@ extern "C" {
{
kNonBlockingUdpFl = 0x00,
kBlockingUdpFl = 0x01,
kNoQueueUdpFl = 0x02
kNoQueueUdpFl = 0x02,
kBroadcastUdpFl = 0x04
};