[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] netconn_connect returns OK when connection refused?
From: |
Grant Edwards |
Subject: |
Re: [lwip-users] netconn_connect returns OK when connection refused? |
Date: |
Fri, 21 Jan 2022 14:37:08 -0000 (UTC) |
User-agent: |
slrn/1.0.3 (Linux) |
On 2022-01-20, Grant Edwards <grant.b.edwards@gmail.com> wrote:
> 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.
There's actually another strange netconn_connect() behavior I've
noticed. I have a test app with 4 client threads that repeatedly
connect to a server, exchange data for a few seconds, then disconnect.
The first three threads that call netconn_connect() get error codes
2,3,4 (always in that order). The fourth thread always connects and
returns OK. A couple seconds later, the first three connect
OK. Subsequent connects always work.
Obvserving the network traffic for the three "failures" show that the
SYN/SYN-ACK/ACK handshake was completed, then the lwIP side
immediately closed the connection with a FIN.
Any ideas on what would cause that sort of behavior?