All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent LEQUIEVRE <laurent.lequievre@gmail.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Laurent LEQUIEVRE <laurent.lequievre@univ-bpclermont.fr>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] need help to Xenomai Cobalt RTnet socket UDP recvfrom non blocking
Date: Fri, 17 Jun 2016 13:28:41 +0200	[thread overview]
Message-ID: <5763DEE9.1000801@gmail.com> (raw)
In-Reply-To: <20160617100728.GK32532@hermes.click-hack.org>

Hi Gilles,

thank you for your quick answers !

where I can find this option : RTNET_RTIOC_TIMEOUT ?

cd /usr/xenomai_3_0_2/include
grep -r RTNET_RTIOC_TIMEOUT

--> Return nothing

Need to include something in my code ?

Thanks,

Laurent


Le 17/06/2016 12:07, Gilles Chanteperdrix a écrit :
> On Fri, Jun 17, 2016 at 11:55:20AM +0200, Laurent LEQUIEVRE wrote:
>> Hello,
>>
>> I installed xenomai 3.0.2 and try to test some RTnet features needed for
>> the communication with my Kuka robot arm.
>>
>> I specify that I want to work with the skin posix only.
>>
>> I need to create a UDP socket with a timeout on the 'recvfrom' function
>> (Non blocking recvfrom).
>>
>> I tested this first code :
>>
>> int udp_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
>> bind(udp_socket, ...)
>> struct timeval timeout;
>> timeout.tv_sec = 1;
>> timeout.tv_usec = 0;
>>
>> setsockopt(udp_socket, SOL_SOCKET, SOCKET_SO_RCVTIMEO, &timeout,
>> sizeof(timeout));
>> --> this function return -1, errno=92, Protocol not available ???
> This socket option is not implemented in RTnet sockets. You can use
> the RTNET_RTIOC_TIMEOUT ioctl instead.
>
>
>> ....
>> recvfrom(udp_socket, ....) --> blocked ??
>>
>> I tested this second code :
>>
>> int udp_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
>> bind(udp_socket, ...)
>> fcntl(udp_socket, F_SETFL, O_NONBLOCK);
>> --> this function return 0
>> ....
>> recvfrom(udp_socket, ....) --> blocked ??
> RTnet UDP recvfrom does not check the O_NONBLOCK flag, you can use
> recvmsg with MSG_DONTWAIT instead.
>



  parent reply	other threads:[~2016-06-17 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17  9:55 [Xenomai] need help to Xenomai Cobalt RTnet socket UDP recvfrom non blocking Laurent LEQUIEVRE
2016-06-17 10:07 ` Gilles Chanteperdrix
2016-06-17 10:21   ` Gilles Chanteperdrix
2016-06-17 11:28   ` Laurent LEQUIEVRE [this message]
2016-06-17 13:04     ` laurent LEQUIEVRE
2016-06-19  6:45       ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5763DEE9.1000801@gmail.com \
    --to=laurent.lequievre@gmail.com \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=laurent.lequievre@univ-bpclermont.fr \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.