lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] netconn_connect returns OK when connection refused?


From: address@hidden
Subject: Re: [lwip-users] netconn_connect returns OK when connection refused?
Date: Fri, 21 Jan 2022 17:28:03 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Am 20.01.2022 um 17:55 schrieb Grant Edwards:
I'm running into a problem where netconn_connect always returns OK
immediately, even when the connection was refused by the server (it
replies to the SYN with a RST). Subsequent attempts to write to the
connection return -14 (ERR_RST) or -11 (ERR_CONN).

Shouldn't netconn_connect() return an error if the connection was
refused?  If the server accepts the conneciton, it seems to work OK.

The only way I would think this could happen is if you are using
nonblocking netconns. Normal blocking netconns should wait for the
remote side to ACK the SYN and only then return ERR_OK.

Regards,
Simon


Here's the relevent code:


       conn = netconn_new(NETCONN_TCP);
       if (!conn)
         {
           printf("conn NULL\n");
           return;
         }
       e = netconn_connect(conn, &ip, 7000);
       if (e != ERR_OK)
         {
           printf("%s[%d] netconn_connect e=%d\n",__func__,exinf,e);
           netconn_delete(conn);
           return;
         }
       printf("connected\n");
       ...
           e = netconn_write_partly(conn, data, dsize, NETCONN_COPY, &written);
           if (e != ERR_OK)
             printf("%s[%d] netconn_write e=%d\n",__func__,exinf,e);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]