[Libwebsockets] [libwebsockets] With new nonblocking socket setting on iOS socket fails on EISCONN (#17)

"Andy Green (林安廸)" andy at warmcat.com
Mon Nov 4 03:36:24 CET 2013

On 30/10/13 01:59, the mail apparently from LANGLOIS Olivier PIS -EXT 
>> -----Original Message-----
>> From: Andy Green [mailto:extracats at googlemail.com] On Behalf Of "Andy
>> Green (???)"
>> Sent: Thursday, October 24, 2013 10:06 AM
>> To: warmcat/libwebsockets; libwebsockets
>> Subject: Re: [Libwebsockets] [libwebsockets] With new nonblocking socket
>> setting on iOS socket fails on EISCONN (#17)
>> On 24/10/13 21:10, the mail apparently from shyswork included:
>>> With new nonblocking socket setting on iOS websocket is closed with
>>> EISCONN 56. It appears that in client-handshake.c in line 87
>>> (https://github.com/warmcat/libwebsockets/blob/master/lib/client-hands
>>> hake.c#L87) only EALREADY and EINPROGRESS are checked. In my situation
>>> I get there first time with EINPROGRESS which is ok but the next time
>>> I get EISCONN which leads to fail. I have put simple check for EISCONN
>>> as quick and dirty fix but I haven't tested it thoroughly.
>> Sorry can you help me understand why we see EISCONN?
> This can be returned by connect():
> 1. If you attempt to connect an already connected socket or
> 2. current socket state is unconnected and the connection completes before returning from connect (is unusual for nonblocking but maybe possible with loopback interface).
> http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L620
>   Maybe on iOS, connect() syscall simply disregard the nonblocking attribute and perform a blocking connect() and indicate success by returning EISCONN.
> Apples OSes do not have the reputation to be very strict with POSIX compliance. Just saying...
> In anycase, I think this should not be considered as a fatal error on Linux or any other platform.

I think it may have meant we wrongly retry conntect() again at least 
once even after the connection is established, and we may have fixed 
that recently with other patches.

However I agree, it's not fatal even so and it's good we're handling it now.


> ________________________________
> CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.

More information about the Libwebsockets mailing list