# sockets_read() on windows

- Thread: https://externals.io/message/10977
- Original archive: https://news-web.php.net/php.internals/10977
- Started by moshe doron on 2004-07-08T12:03:14+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10977 — moshe doron — 2004-07-08T12:03:14+00:00

URL: https://externals.io/message/10977#10977

Hi
Using `socket_read()` on windows with `PHP_NORMAL_READ` (mean read till the next
'\n' or '\r'), php always raise an error even when socket still response.

sniffing around a bit:
http://cvs.php.net/co.php/php-src/ext/sockets/sockets.c?r=1.165#870
http://cvs.php.net/co.php/php-src/ext/sockets/sockets.c?r=1.165#267
http://cvs.php.net/co.php/php-src/ext/sockets/php_sockets_win.c?r=1.11#97

i see that on with the NORMAL flag, `socket_read()` is using the php_read()
function that always fails due to the php_sockets implementation of the
fcntl() call on windows.
according to implementation, php_sockets_win.c fcntl always returns -1 for
F_GETFD,F_SETFD,F_GETFL flags (unsupported?).
the fcntl() call is done to determind if blocking socket for some repeats.

my questions are:
can't fcntl() be implemented for windows at least to detect the non/blocking
thing?
else, we may wants just refering to the socket as blocking on win32, this
behavior is better just then returning error as now.

anyway, if we going to leave this 'behavior' as it, we need to give the
windows user fair explain on the function parameters parsing step and on the
documentation.

more point:
on the php.ini.dist i see:
'sockets.use_system_read = On'
but without considering the socket_globals definition, there is no ref on
the code to this thing, is this directive conected to the above issue?


Moshe
