[En-Nut-Discussion] NutTcpAccept Timeout

en-nut-discussion-admin at egnite.de en-nut-discussion-admin at egnite.de
Tue Jun 24 03:43:46 CEST 2003


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

int NutTcpStatePassiveOpenEvent(TCPSOCKET * sock)
{
    if (sock->so_state != TCPS_CLOSED)
        return (sock->so_last_error = EISCONN);

    NutTcpStateChange(sock, TCPS_LISTEN);

    /*
     * 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?

Thanks
Ralph


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003




More information about the En-Nut-Discussion mailing list