Skip to contentSkip to conversation

socket XDDP recvfrom timeout ?

Xenomai Laurent LEQUIEVRE 2 participants 3 messages Jun 24, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I try to use the socket XDDP with the posix skin to communicate from RT thread to non RT thread.

To get a non blocked 'recvfrom', I added the flag 'MSG_DONTWAIT', and it's work fine.

But how to setup a timeout for this function ?

I tried to set the flag 'SO_RCVTIEMO' by using 2 methods :

struct timeval tv;
tv.tv_sec=nb seconds
tv.tv_usec=nb micro seconds
setsockopt(socket_id,SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); --> doesn't work, blocked !

timeout (in nano seonds)
ioctl(socket_id, SO_RCVTIMEO, &timeout); --> doesn't work, blocked !

Thanks for your help,

Laurent LEQUIEVRE

#1 lore raw

forgot to specify : Xenomai 3.0.2

Quoted 25 lines · Laurent LEQUIEVRE

Hello,

I try to use the socket XDDP with the posix skin to communicate from RT thread to non RT thread.

To get a non blocked 'recvfrom', I added the flag 'MSG_DONTWAIT', and it's work fine.

But how to setup a timeout for this function ?

I tried to set the flag 'SO_RCVTIEMO' by using 2 methods :

struct timeval tv;
tv.tv_sec=nb seconds
tv.tv_usec=nb micro seconds
setsockopt(socket_id,SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); --> doesn't work, blocked !

timeout (in nano seonds)
ioctl(socket_id, SO_RCVTIMEO, &timeout); --> doesn't work, blocked !

Thanks for your help,

Laurent LEQUIEVRE

#2 lore raw
Quoted 1 line · Laurent LEQUIEVRE

forgot to specify : Xenomai 3.0.2

Just a simple reminder. The Xenomai mailing list is a "subscriber only" mailing list. Which means you must be subscribed to be allowed to post. And when I say you, I mean "one e-mail address". So, if you want to use a second mail address, you must subscribe this second mail address (and disable mail delivery if you do not want to receive the e-mails twice).

Signature · 2 lines
					    Gilles.
https://click-hack.org