Socket Communication

frank.ueberschar at frank.ueberschar at
Tue Sep 11 13:00:02 UTC 2007

To whom it may concern, 

I have a small answer regarding TCP/IP sockets in 
an older Version of RTEMS (4.5.1).  Even if that version
was timed-out for many users...

We are always using a task pair for Socket Communication. 
One for the receiver one for the sender in blocking mode. 
Both are using the same socket. 

My Problem appears when closing this socket on error or if the 
destintation system broke down without closing the TCP connection. 
Sometimes the Receive Task does not recognize the socket beeing closed 
and other times the send task seems to wait for an event rising (sbwait()). 

What I want to achive is shutting down the tasks and become ready for 
the next communication connect. 

What could be an approved solution for that? Do I need to 
dup() the socket -- but this seems not to work on that RTEMS version? 
(This would in my opinion work-around spurious NOFDREF RTEMS-Fatals)
Opening another socket and connect this would not work for us. 

For now the sollution for me was to have a third task keeping
track of timeout pings and close the socket in that context. But when 
got returned an error from send() or recv(), one of the tasks has to 
close the socket. In this state the receiver or the sender task 
would block forever. (For now we let the reading task wait for the
sender task until it leaves the blocking mode.)

Any comments ?

Thank you in advance, 

More information about the users mailing list