[Vm-dev] sqSocketListenOnPortBacklogSizeInterface problems

Levente Uzonyi leves at elte.hu
Sat Dec 20 16:19:10 UTC 2014

Hi All,

This function of the SocketPlugin is implmeneted differently on win32 and 
unix, and I find both implementations suboptimal.

Difference #1:
On windows the addr parameter is ignored if the socketType is not 
TCPSocketType. This makes it impossible to bind a UDP socket to a 
specific IP address.

Difference #2:
If the requested port on the given interface is not available for the 
given socket type, then on windows the primitive will fail.
On unix the primitive swallows the error. In case of TCP sockets accept 
will fail (whenever it's called). The only direct indicator of the failure 
is that the local port number will be a random value instead of the 
requested one.
For UDP sockets, there will be multiple sockets bound to the same IP/port, 
but the created socket will not receive packets.

I think the primitive must fail if binding the socket is not possible.
I also think that the requested IP address must not be ignored.
Is it just an oversight, or is there a good reason why these are 
implemented the way they are?


More information about the Vm-dev mailing list