AnsweredAssumed Answered

Non-blocking UDP receive problem - Error 0x1120

Question asked by Michael Wahler on Jul 29, 2014
Latest reply on Aug 13, 2014 by Michael Wahler

Hi,

 

I'd like to receive UDP packets in a non-blocking way. The problem is that recvfrom returns error 0x1120.

 

Here's how I initialize the UDP socket:

 

socket_handle = socket(AF_INET, SOCK_DGRAM, 0);

server_socket_addr.sin_family      = AF_INET;

server_socket_addr.sin_port        = port;

server_socket_addr.sin_addr.s_addr = INADDR_ANY;

status = bind(socket_handle, &server_socket_addr, sizeof(server_socket_addr));

uint32_t opt_value = TRUE;

uint32_t opt_length = sizeof (uint32_t);

status = setsockopt (

  socket_handle,

  SOL_UDP,

  OPT_RECEIVE_NOWAIT,

  &opt_value,

  opt_length

  );

_UDP_max_queue_size = 1;

 

Cyclically, I call

 

recvfrom(socket_handle, buffer, sizeof(buffer), 0, &client_socket_addr, &socket_addr_len)

 

But this line returns error 0x1120. In rtcs_err.h the corresponding line says

 

     #define RTCSERR_OUT_OF_BUFFERS          (RTCS_ERROR_BASE|0x120)

 

Any ideas how to solve this problem? The blocking variant works, by the way.

 

Kind regards

 

Michael

 

 

--

Setup: CW 10.6, MQX 4.1, TWR-K60F120M

Outcomes