All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Doug Brunner <dbrunner@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Intermixing native and POSIX skins
Date: Mon, 02 Apr 2012 17:50:53 +0200	[thread overview]
Message-ID: <4F79CADD.9020704@domain.hid> (raw)
In-Reply-To: <1332884156.408323832@domain.hid>

On 03/27/2012 11:35 PM, Doug Brunner wrote:
> The usage pattern would be a bit like BSD ptys--the server maintains a few ports, say named "server0" through "server15" and clients that need a port try "server0", if it's busy then try "server1", etc..

An option to mimic this partially might be to define a fixed port number 
clients would use to ask the server for a free port to connect to later 
on? The server would let the RTIPC layer pick a free port when binding, 
then return it to the client via a converse message to the fixed port.

>
> I suppose the problem here is really that the application running over these sockets is stateful, the configuration of the nodes (processes) that are communicating is not known until run time, and nodes may appear and disappear as the server runs, so the transport needs to be connection-oriented rather than message-oriented. The semaphore is still a bit of a kludge, since it doesn't notify a thread blocked on recv() that the remote has hung up, but it works well enough in conjunction with a message that says "I'm a client that's newly connected to this server" to reset the state associated with the connection. I suppose I could implement a sort of TCP handshake on top of the IDDP socket layer and use that to provide true connection-oriented behavior.

Yep, RTIPC won't help that much by default in that area, it only 
exhibits connectionless semantics.

>
> Good to know about in-order delivery; a quick glance at the source code seemed to suggest that, but I wasn't sure.
>
>      Doug Brunner
>
> -----Original Message-----
> From: "Philippe Gerum"<rpm@xenomai.org>
> Sent: Tuesday, March 27, 2012 9:26am
> To: "Doug Brunner"<dbrunner@domain.hid>
> Cc: xenomai@xenomai.org
> Subject: Re: [Xenomai-help] Intermixing native and POSIX skins
>
> On 03/26/2012 06:14 PM, Doug Brunner wrote:
>> Thanks for the information--the issue is not about picking a free port on the server side, but rather about communicating the information on which ports are "free" to the clients (server has connected its end, but no other client is using the port). The semaphore mechanism isn't that much of a problem, though; I've been able to build a satisfactory implementation.
>
> Mm, still scratching my head to understand the issue. Both the client
> and server side accept -1 as the port spec, telling the kernel to draw a
> free port. I understand the issue is not on the server side, so is it on
> the client side?
>
> Could you sketch the usage pattern?
>
>>
>> One other question: although I know in-order delivery isn't necessarily a feature of datagram based protocols, would I get that with an IDDP socket connection between just two processes, and/or an XDDP connection to a /dev/rtpN?
>
> Yes, in-order delivery is guaranteed with all RTIPC protocols. This is
> written in stone.
>
>>
>>       Doug Brunner
>>
>> -----Original Message-----
>> From: "Philippe Gerum"<rpm@xenomai.org>
>> Sent: Friday, March 16, 2012 11:29am
>> To: "Doug Brunner"<dbrunner@domain.hid>
>> Cc: xenomai@xenomai.org
>> Subject: Re: [Xenomai-help] Intermixing native and POSIX skins
>>
>> On 03/15/2012 05:30 PM, Doug Brunner wrote:
>>> Thanks Philippe. I hadn't even known about the existence of the RTIPC driver, and I definitely like the idea.
>>>
>>> I've been experimenting with it a bit today, and found that it seems to be allowed for more than two sockets to connect to the same port. I modified iddp-sendrecv.c to have two client processes, both of which now connect to the same port as the server, then did the same thing with iddp-label.c (two clients both connect()ing to the same label).
>>>
>>> This would cause havoc with the communications that go on between my processes--they need a one-to-one channel. I could implement semaphores to enforce this, but it would be nice to avoid that complication. Is there a way to make it happen using just the socket interface?
>>
>> The RTIPC protocols are fundamentally datagram-based, so allowing N:1
>> data paths is wanted. If the issue is about picking a different port
>> each time you bind a server socket in the AF_RTIPC domain, then I would
>> suggest to set sipc_port to -1 when binding the server-side socket: a
>> free port will be picked automatically. You could then use getsockname()
>> to retrieve the actual port #, and pass it to the clients.
>>
>
>


-- 
Philippe.


  reply	other threads:[~2012-04-02 15:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 19:12 [Xenomai-help] Intermixing native and POSIX skins Doug Brunner
2012-03-12 19:43 ` Philippe Gerum
2012-03-15 16:30   ` Doug Brunner
2012-03-16 18:29     ` Philippe Gerum
2012-03-26 16:14       ` Doug Brunner
2012-03-27 16:26         ` Philippe Gerum
2012-03-27 21:35           ` Doug Brunner
2012-04-02 15:50             ` Philippe Gerum [this message]
2012-03-28  5:39 ` [Xenomai-core] [PATCH] Mask signals in rt_print:printer_loop() Paul Janzen
2012-03-28 13:35   ` 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=4F79CADD.9020704@domain.hid \
    --to=rpm@xenomai.org \
    --cc=dbrunner@domain.hid \
    --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.