<div dir="ltr"><p class="gmail-isSelectedEnd">Hello
LIVE555 developers,</p><p class="gmail-isSelectedEnd">While debugging an issue on a
Cygwin/Windows build of LIVE555, I noticed that <code dir="ltr">readSocket()</code> in <code dir="ltr">groupsock/GroupsockHelper.cpp</code> uses hard-coded Linux errno values:</p><pre dir="ltr"><code dir="ltr">if (err == 111 /*ECONNREFUSED (Linux)*/
...
|| err == 113 /*EHOSTUNREACH (Linux)*/) {
return 0;
}</code></pre><p class="gmail-isSelectedEnd">Using numeric errno values appears to be fragile across platforms.</p><p class="gmail-isSelectedEnd">On my
Cygwin
build, I observed:</p><pre dir="ltr"><code dir="ltr">err = 113
strerror(err) = "Software caused connection abort"
EHOSTUNREACH = 118</code></pre><p class="gmail-isSelectedEnd">As a result, the code treats errno 113 as if it were Linux <code dir="ltr">EHOSTUNREACH</code>, even though on this platform it represents a different condition. This caused <code dir="ltr">readSocket()</code> to return 0 instead of propagating the socket error, leading to a connection that remained active indefinitely.</p><p class="gmail-isSelectedEnd">Would it make sense to replace the hard-coded values with symbolic constants, e.g.:</p><pre dir="ltr"><code dir="ltr">if (err == ECONNREFUSED
#if defined(__WIN32__) || defined(_WIN32)
|| err == 0 || err == EWOULDBLOCK
#else
|| err == EAGAIN
#endif
|| err == EHOSTUNREACH) {
return 0;
}</code></pre><p class="gmail-isSelectedEnd">This would avoid assumptions about platform-specific errno numbering and prevent accidental matches when errno values differ from Linux.</p><p>Best regards,<br>Nikolay Isaev</p></div>