[Libwebsockets] 回复: 答复: A question about libwebsockets dns resolve

andy at warmcat.com andy at warmcat.com
Mon May 25 21:17:05 CEST 2020

On May 25, 2020 11:04:00 AM UTC, huangkaicheng <huangkaicheng at huawei.com> wrote:
>I mean that the first resolved ip, it can wait connect until time out.
>And but second,third,and other it will not. It is not just 127.0.x. you
>can change to make sure (onevalid.bogus.warmcat.com) dns resolve like
>( can reach) ,,,  .
>other Ip(unreachable it should wait connect util time out ).in last old
>version(a week ago), it will wait some time rather than finish quickly.
>It is quite different with last version(a week ago).

I looked at this earlier and pushed a patch adding a separate configurable timeout for the whole connect (default 20s) and reduced the timeout for individual dns connect attempts to default to 5s.


It seems to work as before on Linux, on windows I cannot control the dns ordering, both my test dns records 'just work' each time for whatever reason, 127.xxx is never tried.


>发件人: Andy Green [mailto:andy at warmcat.com] 
>发送时间: 2020年5月25日 17:03
>收件人: huangkaicheng <huangkaicheng at huawei.com>; libwebsockets
><libwebsockets at ml.libwebsockets.org>
>抄送: Chenyake <chenyake at huawei.com>
>主题: Re: 回复: [Libwebsockets] 答复: A question about libwebsockets dns
>On 5/25/20 9:31 AM, huangkaicheng wrote:
>> Hi ,
>>       I use test-client project in websockes previous. And it is not 
>> my code. it is about your code in your project.
>OK, fair enough.
>But what I mean is please make it easy for me to reproduce your
>problem, ie minimal example, if a diff, give me the diff, and give me
>the commandline.  Then I can know if I can spare a few minutes, I can
>stop what I am doing and look at it (and I know immediately that it is
>about a minimal example, which makes me much more want to stop and
>As Jaco says I am not sure if it just confuses the issue with the
>"timedout" log.  On some platforms, 127.0.0.x port closed acts like
>closed and send you a FIN, on other platforms (IIRC OSX) it acts like
>it was DROPped and waits.  If on windows platform it resets the
>connection, like on Linux, it will not wait around and just fail
>immediately, the log may not reflect the reality of why it gave up
>then, which is not ideal but not really a crisis.
>> mkdir build
>> cd build
>> cmake .. -DLWS_WITH_SSL=0
>> cmake --build . --config DEBUG
>>       And I use 
>>        If I want to use minimal-ws-client, how can I build it
>success. I 
>> build it failed.
>> -----邮件原件-----
>> 发件人: Andy Green [mailto:andy at warmcat.com]
>> 发送时间: 2020年5月25日15:50
>> 收件人: huangkaicheng <huangkaicheng at huawei.com>; libwebsockets 
>> <libwebsockets at ml.libwebsockets.org>
>> 抄送: Chenyake <chenyake at huawei.com>
>> 主题: Re: 回复:[Libwebsockets] 答复: A question about libwebsockets dns 
>> resolve
>> On 5/25/20 8:35 AM, huangkaicheng wrote:
>>> Hi,
>>>  there is still something wrong with latest code. Why try to
>>> connect,, time out so quickly?
>> Can you please show me this using the lws minimal examples rather
>> your code?  That way I can try the same thing quickly and have some 
>> reason to think we are looking at the same problem, and if I change 
>> something, that it solves the problem.
>> -Andy

More information about the Libwebsockets mailing list