AnsweredAssumed Answered

UDP none blocking recvfrom(... RTCS_MSG_PEEK ...) causing RTCSERR_UDP_PORT_ZERO

Question asked by Carl Norman on Feb 3, 2010
Latest reply on Feb 15, 2010 by Carl Norman

Hi,

 

RTCS_geterror(sock); is returning

 

#define RTCSERR_UDP_PORT_ZERO    (RTCS_ERROR_BASE|0x665)    /* can't send to port 0  */

 

after I do something like this (just to illustrate easily the problem):

 

sendto();

_time_delay(10);

recvfrom(... RTCS_MSG_PEEK  ...); //no data to receive as the turn around time is 100mS

//Quickly try to resend

sendto(); //This will ALWAYS return the above error

 

so I tried this

 

sendto();

_time_delay(1);

recvfrom(... RTCS_MSG_PEEK  ...); //no data to receive as the turn around time is 100mS

shutdown(sock...);

sock = socket(PF_INET, SOCK_DGRAM, 0);

error = bind(sock, &local_sin, sizeof(local_sin));

sendto(); //This will ALWAYS return the above error

 

 

The point is, I need to be able to have a UDP timeout and retry, so i need to use recvfrom() as a non blocking to make my timeout, but cannot work out what to do to shutdown() and socket_bind()  to get it to come back so that I can send again...

 

 Normally,if message peek returns no error and none zero, I do a normal recvfrom(); to get the datagram. all this works fine, ist only a problem when the timeout happens

 

Message Edited by CarlFST60L on 2010-02-03 06:29 AM

Outcomes