|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-07 12:30 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jan 12 08:00:02 2026 UTC |
Description: ------------ I tested this also on Linux and it works ok. When I use socket_read with PHP_NORMAL_READ as third parameter it gaves me a warning and doesn't take into account the if the socket is blocking. I looked in the sources but I found nothing that would let me know why is this happening (maybe in php_read ?). I've seen that there are a lot of bugs with this function on Win32. A very good ideea would be to rewrite it from scratch. Reproduce code: --------------- $g = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); socket_connect ($g, "helsinki.fi.eu.undernet.org", 6667); socket_set_block ($g); $s = "USER flachi flachi flachi :flachi\r\nNICK floadssaas\r\n"; socket_write ($g, $s, strlen ($s)); while (($s = socket_read ($g, 512, PHP_NORMAL_READ)) !== false) { echo $s; } socket_shutdown ($g, 2); socket_close ($g); Expected result: ---------------- This should connect to that IRC server and get some lines of code. Here is how it should work (and does on Linux): ~$ php -q test3.php NOTICE AUTH :*** Looking up your hostname NOTICE AUTH :*** Checking Ident NOTICE AUTH :*** Couldn't look up your hostname PING :34913160 Actual result: -------------- This is what I get on Windows. It doesn't receive anything from the IRC server. G:\Foo\fbot>php -d output_buffering=8 -d html_errors=off -q test.php PHP Warning: socket_read() unable to read from socket [0]: The operation completed successfully. in G:\Foo\fbot\test.php on line 8