[En-Nut-Discussion] Problem with UDP sockets

george diam gnagiag at yahoo.gr
Sun Oct 12 22:47:26 CEST 2003


Hello to everyone,
 
For a while now, I am trying to use UDP sockets to listen to a broadcast message from a server of mine to an exact port 4984 thru my network but I keep on getting the above message Timeout Occured while trying to listen to Broadcast IP. What ever I have tryied has failed since now.
 
Example of my code:
 
UDPSOCKET *udpClient;
int ret; 
u_long ClientAddress;
u_short ClientPort;
unsigned char *rxBuffer;

rxBuffer = NutHeapAlloc(256);

udpClient=NutUdpCreateSocket(4984); 

while(ServerSocketID==0)
{
 memset(rxBuffer,0,256);
 switch(ret=NutUdpReceiveFrom(udpClient,&ClientAddress,&ClientPort,rxBuffer,sizeof(RxBuffer),4000))
{
case -1:{
printf("An error occured while trying to listen to Broadcast IP.\n");
break;}
case 0:{
printf("Timeout Occured while trying to listen to Broadcast IP.\n");
break;}
default:{
printf("Received %s\n",rxBuffer);
ServerSocketID=ClientAddress; 
printf("Server was at address :%s\n",inet_ntoa(ServerSocketID)); 
NutUdpDestroySocket(udpClient);
break;} 
} 
}

Can anyone tell me what I'm doing wrong, or even better to send me code that it is actually working.
 
Thanks for your help.



---------------------------------
Do You Yahoo!?
Αποκτήστε την δωρεάν σας@yahoo.gr διεύθυνση  στο Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20031012/03da1f97/attachment.html>


More information about the En-Nut-Discussion mailing list