[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 17:21:48 -0000 (UTC) |
User-agent: |
slrn/1.0.3 (Linux) |
On 2022-01-21, goldsimon@gmx.de <goldsimon@gmx.de> wrote:
> Am 21.01.2022 um 15:37 schrieb Grant Edwards:
>> 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).
>
> I'm not sure what you mean here. err_t error codes should be negative.
> With "2,3,4", do you mean ERR_BUF, ERR_TIMEOUT, ERR_RTE? That would be
> strange.
Huh. I double-checked, and the returned values are positive 2, 3, 4. I
handn't noticed that they should be negative.
There's definitely something very odd going on with netconn_connect().
I must have a buffer/stack overflow or something...
--
Grant