How to make pipe on RTEMS?

Eric Norum eric.norum at usask.ca
Fri Sep 20 16:18:41 UTC 2002


On Friday, September 20, 2002, at 09:47 AM, Vladimir Nesic wrote:

> On Friday 20 September 2002 16:47, Joel Sherrill wrote:
>> Thomas Doerfler wrote:
>>> Hi Vladimir,
>>>
>>>> Thank You for answers, but now I have a question about sockets:
>>>> Is it possible to make a socket of type AF_LOCAL under RTEMS?
>>>
>>> no, it ain't. I have tried it out some weeks ago
>>> because it would be a very fine replacement for
>>> pipes, but it seems the AF_LOCAL address scheme
>>> is not implemented in the RTEMS networking stack.
>>
>> I don't know if this is the problem but ...
>>
>> Do you have the loop driver in your configuration?
>
> I do have it, but but the problem is that I don't need one, but unknown
> number of pipes. If I go through loopback interface with AF_INET I must
> include some counting to avoid two threads listening on the same port
> :(
>
> I have checked out how socketpairt is done on linux, and they make a
> socket and asign two filedes to it, but in rtems code there is call to
> rtems_panic if there are two threads waitng for the same socket :(
>
>

Why would you want more than one thread reading from a socket or pipe?  
How could you control which thread got which data?

To create multiple pipes you just need to choose a unique sin_port each 
time you bind the socket to an address since a TCP/IP stream is defined 
by four values (source IP host number, source port, destination IP host 
number, destination port).

I've attached the little test program I wrote to verify the network 
stack code without using a network interface.  Perhaps it may be of 
some help to you.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: netTest.c.gz
Type: application/x-gzip
Size: 2424 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20020920/f24b39ce/attachment-0001.bin>
-------------- next part --------------

-- 
Eric Norum <eric.norum at usask.ca>
Department of Electrical Engineering
University of Saskatchewan
Saskatoon, Canada.
Phone: (306) 966-5394   FAX:   (306) 966-5407



More information about the users mailing list