Porting a simple application for BSD sockets we faced the following problem:
the original code was an evergreen of socket programming:
this call returns a socket handle sh=0, which, according to embOS/IP documentation, is a valid handle, but subsequent calls to getsockopt() and setsockopt() return -1;
We then discovered that the same example works replacing the socket creation code with:
We suggest to treat internally any non-zero value passed as third parameter like a passed "0" to ease portings, otherwise we'll need to modify all socket() calls.
Could you also clarify if sh=0 is a valid socket or not?
Thanks
Francesco
the original code was an evergreen of socket programming:
this call returns a socket handle sh=0, which, according to embOS/IP documentation, is a valid handle, but subsequent calls to getsockopt() and setsockopt() return -1;
We then discovered that the same example works replacing the socket creation code with:
We suggest to treat internally any non-zero value passed as third parameter like a passed "0" to ease portings, otherwise we'll need to modify all socket() calls.
Could you also clarify if sh=0 is a valid socket or not?
Thanks
Francesco