Multiple Sockets

Eric Norum eric.norum at
Fri Dec 21 14:15:39 UTC 2001

> Bhawani Mittal wrote:
> Hi All,
> In FreeBSD, multiple sockets are taken care by the proc structure.
> But in retem, proc has been implementated as a dummy structure.
> So, in retem can I operate on multiple sockets ( created by multiple
> tasks ) simultaneously ?
> If yes, can anybody tell me how this thing is taken care in RETEM.

Then answer is yes.  The only restriction is that a given socket can be
read or written by only one task a time.  This is described in the
networking supplement to the RTEMS documentation.  I've included the
salient section below.  The restriction is pretty minor.  I can't think
of any reason why you'd ever want to have two tasks reading from a
particular socket at the same time.  Two or more tasks writing to a
socket at the same time is pretty unlikely too since you'd have problems
with data coherency.

3.4: Application Programming Interface

      Network Statistics 
      Tapping Into an Interface 
      Socket Options 
      Time Synchronization Using NTP 

The RTEMS network package provides almost a complete set of BSD network
services. The network functions work like their BSD counterparts with
the following exceptions: 

      A given socket can be read or written by only one task at a time. 
      The select function only works for file descriptors associated
with sockets. 
      You must call openlog before calling any of the syslog functions. 
      Some of the network functions are not thread-safe. For example the
following functions return a pointer to a static buffer which remains
valid only until the next call: 
            (inet_ntop is thread-safe, though). 
      The RTEMS network package gathers statistics. 
      Addition of a mechanism to "tap onto" an interface and monitor
every packet received and transmitted. 
      Addition of SO_SNDWAKEUP and SO_RCVWAKEUP socket options.

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

More information about the users mailing list