[En-Nut-Discussion] NutTcpAccept blocks the tread

Henrik Maier hmnews at proconx.com
Tue Oct 20 02:07:48 CEST 2009


Hi all,

I proposed quite some time ago to make NutTcpAccept time-out. I think I
recommended to make NutTcpAccept to honour the receive time-out. Harald was
concerned to change the behaviour of NutTcpAccept back then and proposed a
separate time-out parameter instead. However that proposal never got
implemented in the core as for most applications the current blocking
behaviour is suitable.

I actually created a private patch of NutTcpAccept for my applications to
use the receive time-out.
 
Henrik

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Ole Reinhardt
> Sent: Tuesday, 20 October 2009 2:01 AM
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] NutTcpAccept blocks the tread
> 
> Hello!
> 
> > The function NutTcpAccept() is blocking the calling thread, so I have to
> > spend for each connection his own thread. In this way I have a lot of
> > unnecessary taskswitches and I block unnecessary Memory.
> > Is there an other way (not blocking) for waiting for a connection (with
an
> > Error-Message "no actual connection")?
> 
> No, not directly. NutTcpAccept calls NutTcpStatePassiveOpenEvent, an
> internal function of the tcp state machine, which sets the socket into
> the listen state and then waits for an event on the sock->so_pc_tq event
> queue.
> 
> This functions waits infinit. So your application will block at this
> point until the socket gets connected.
> 
> I don't have enough deep knowledge of the tcp state machine, but
> would'nt it be possible to add a timeout parameter to NutTcpAccept which
> will be passed to the NutEventWait?
> 
> Bye,
> 
> Ole
> 
> --
>  _____________________________________________________________
> |                                                             |
> | Embedded-IT                                                 |
> |                                                             |
> | Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
> | Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
> | 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
> | Germany              Web:         http://www.embedded-it.de |
> |_____________________________________________________________|
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list