SENA HD132x Series User Manual
Page 51
Advertising
HD132x Series User Manual
51
// UDP Socket function
void UDPSocketCreate() ;
void UDPSocketRun() ;
void UDPSocketClose() ;
// Main function
void main()
{
printf("UDP Hello Device Program \n");
// 1) Socket Creation
UDPSocketCreate() ;
while(1)
{
// 2) Listen until any incoming data
// 3) Receive if any incoming data
// 4) Print data
UDPSocketRun();
}
// 5) Close UDP Socket
UDPSocketClose() ;
}
//---------------------
// UDP Socket Creation
//---------------------
void UDPSocketCreate()
{
// Windows requires that winsock be initialized.
if (WSAStartup (0x0101, &lpWSAData) == INVALID_SOCKET)
{
printf("\nCannot open WinSock???\n");
exit (1) ;
}
else
Advertising