[En-Nut-Discussion] NutTcpAccept blocks the tread

Ole Reinhardt ole.reinhardt at embedded-it.de
Mon Oct 19 18:00:52 CEST 2009


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 |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list