All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Leopold Palomo-Avellaneda <leo@alaxarxa.net>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Xddp protocol: question of one example
Date: Fri, 20 Dec 2013 15:49:23 +0100	[thread overview]
Message-ID: <52B458F3.70708@xenomai.org> (raw)
In-Reply-To: <201312201343.01875.leo@alaxarxa.net>

On 12/20/2013 01:42 PM, Leopold Palomo-Avellaneda wrote:
> A Divendres, 20 de desembre de 2013, Philippe Gerum va escriure:
>> On 12/19/2013 12:37 AM, Leopold Palomo-Avellaneda wrote:
>>> Hi,
>>>
>>> I'm developing an application that need (as always) interchange data
> between a realtime part and non-realtime.
>>>
>>> Looking on the documentation and surfing on the web I have found
> interesting for my app the examples of xddp protocol. Some time ago, there was
> an interesting mail about it [1].
>>>
>>> There, the original author ask one thing that I would like to be sure that
> I understood. On the examples, the realtime thread uses the function
> recvfrom() to receive data from the non-rt thread.
>>>
>>> In the mail, the original author asked about make recvfrom
>>> call non-blocking in xddp context, and *Philippe Gerum* answered that
>>> MSG_DONTWAIT should be set in flags.
>>>
>>> So, my question is that using that flag, some code like this:
>>>
>>>
>>> /* Read back packets echoed by the regular thread */
>>> ret = recvfrom(s, buf, sizeof(buf), 0, NULL, 0);
>>> if(ret <= 0)
>>>       fail("recvfrom");
>>>
>>> recvfrom will not be blocked, but it will return 0?
>>>
>>> May I understood that if there's data on the sockect recvfrom will
>>> return something and if no, it would not be blocked and return something?
>>>
>>
>> Standard behavior when no data present: immediate return with ret = -1,
>> errno = EWOULDBLOCK/EAGAIN.
>
> Ok,
>
> if you are writing some data (some bytes) in the socket, can I trust that
> recvfrom will return -1 until ALL data is transferred?
>

Yes, guaranteed for all nrt -> rt transfers. This also applies the other 
way, unless MSG_MORE is given to sendmsg() with streaming mode enabled 
for the socket, and the message spans multiple output buffers (see 
setsockopt(XDDP_BUFSZ) for enabling streaming mode).

-- 
Philippe.


      reply	other threads:[~2013-12-20 14:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 23:37 [Xenomai] Xddp protocol: question of one example Leopold Palomo-Avellaneda
2013-12-20 10:13 ` Philippe Gerum
2013-12-20 12:42   ` Leopold Palomo-Avellaneda
2013-12-20 14:49     ` Philippe Gerum [this message]

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=52B458F3.70708@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=leo@alaxarxa.net \
    --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.