Part Number: CC3200-LAUNCHXL
Tool/software: TI C/C++ Compiler
Hi,
I'm using CC3200 Module for my application,I am trying to listen to UDP Multicast messages with udp socket on port 5353, Sl_Blind returns -100, i am UDP Socket example code.
int BsdUdpServer(unsigned short usPort)
{
SlSockAddrIn_t sAddr;
SlSockAddrIn_t sLocalAddr;
int iCounter;
int iAddrSize;
int iSockID;
int iStatus;
long lLoopCount = 0;
short sTestBufLen;
// filling the buffer
for (iCounter=0 ; iCounter<BUF_SIZE ; iCounter++)
{
g_cBsdBuf[iCounter] = (char)(iCounter % 10);
}
sTestBufLen = BUF_SIZE;
//filling the UDP server socket address
sLocalAddr.sin_family = SL_AF_INET;
sLocalAddr.sin_port = sl_Htons(5353);
sLocalAddr.sin_addr.s_addr = 0;
iAddrSize = sizeof(SlSockAddrIn_t);
// creating a UDP socket
iSockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
if( iSockID < 0 )
{
// error
ASSERT_ON_ERROR(SOCKET_CREATE_ERROR);
}
// binding the UDP socket to the UDP server address
iStatus = sl_Bind(iSockID, (SlSockAddr_t *)&sLocalAddr, iAddrSize);
if( iStatus < 0 )
{
// error
sl_Close(iSockID);
ASSERT_ON_ERROR(BIND_ERROR);
}
// no listen or accept is required as UDP is connectionless protocol
/// waits for 1000 packets from a UDP client
while (lLoopCount < g_ulPacketCount)
{
iStatus = sl_RecvFrom(iSockID, g_cBsdBuf, sTestBufLen, 0,
( SlSockAddr_t *)&sAddr, (SlSocklen_t*)&iAddrSize );
if( iStatus < 0 )
{
// error
sl_Close(iSockID);
ASSERT_ON_ERROR(RECV_ERROR);
}
lLoopCount++;
}
UART_PRINT("Recieved %u packets successfully\n\r",g_ulPacketCount);
//closing the socket after receiving 1000 packets
sl_Close(iSockID);
return SUCCESS;
}
Thanks,
Nagaraj