[En-Nut-Discussion] NutTcpAccept Timeout

Alessandro Zummo azummo-enutdisc at towertech.it
Tue Jun 24 12:54:56 CEST 2003


On Tue, 24 Jun 2003 13:43:46 +1200
en-nut-discussion-admin at egnite.de wrote:

> I need to implement a timeout on NutTcpAccept.
> 
> I have changed the tcp_socket structure adding an accept timeout
> so_accept_to and allowing it to be set via SetSockOpt.
> 
> I changed the following function

[..]\
>      * Block application.
>      */
>     if (  NutEventWait(&sock->so_pc_tq, sock->so_accept_to) ) {
> 		return (sock->so_last_error = ETIMEDOUT);
>     }
> 
>     return 0;
> }
> 
> I noticed that the NutTcpAccept documentation is a little wrong, it will
> return the ERROR code (not -1) on an error.
> 
> Can anyone verify if this is safe to do?

I would first check if so_accept_to is != 0. 


-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it



More information about the En-Nut-Discussion mailing list