I have a wrapper of socket, using WinSock2 on Windows. I have a test program that runs in client or server mode in both blocking and nonblocking mode. I tested it between PC and MAC and it worked fine. When testing between iOS and PC a connect
after setting the socket to nonblocking (with a successful socket.Blocking = false
) failed with 10036 aka WSAEINPROGRESS
. I normally expect a 10035 aka WSAEWOULDBLOCK
, as described in MSDN documentation [1] . On linux it would give EINPROGRESS
[2], so I thought maybe it could be an error of the IL2CPP implementation for iOS.
If I treat that WSAEINPROGRESS
as WSAEWOULDBLOCK
, the test program works as expected.
UPDATE: I discovered later that Socket.RemoteEndPoint
is null after the broken connect. I only managed to have it work using the overload Socket.Connect( string, int )
with .Net 3.5.
Basically I call Socket socket = Socket( ... )
, socket.Blocking = false
and socket.Connect( string ip, UInt16 port )
, which fails trowing a SocketException
that has ErrorCode = InProgress
. Note that it should beWouldBlock
; InProgress
is described as A blocking operation is in progress.
[3].
I have all the doubts on my correctness and on the fact that this is a bug of IL2CPP, so I’m asking here.
[1] Windows Sockets Error Codes (Winsock2.h) - Win32 apps | Microsoft Learn