[En-Nut-Discussion] NutTcpAccept blocks the tread

Nathan Moore nategoose at gmail.com
Fri Oct 23 16:18:11 CEST 2009


Hey Harald,

>
> Considered, that NutTcpPassiveOpenEvent had been changed following your
> suggestion, the application will use the following pseudo code:
>
> for (;;) {
>  CreateSocket();
>  SocketOption(Set read timeout);
>  while (NutTcpAccept()) {
>    /* Timout, do something else,
>    ** but do not sleep. */
>  }
>  /* Handle the connection. */
>  ...
>  /* Finally */
>  DestroySocket();
> }
>
> Is that what you meant?


Yes.  It could check a variable or something and never open the window of
not listening to that port.
If it did sleep there it would still work, but would introduce the
possibility that you wouldn't be listening for a moment..


Nathan



More information about the En-Nut-Discussion mailing list