#21197 [Opn->Fbk]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
From: sniper@php.net Date: Mon, 05 Dec 2005 18:04:08 +0000 Subject: #21197 [Opn->Fbk]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-89778@lists.php.net to get a copy of this message
ID: 21197
Updated by: sniper@php.net
Reported By: bool at boolsite dot net
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: *
PHP Version: 5.*, 4.* (2005-11-17) (cvs)
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-11-05 22:10:22] nlopess@php.net
I've made a patch that implements the idea of my last comment. The test
case now works properly.
I haven't tested bug #35062 but it seems to be a different bug.
http://mega.ist.utl.pt/~ncpl/php_sockets_win.txt
------------------------------------------------------------------------
[2005-11-05 01:36:39] nlopess@php.net
I was walking through the MSDN docs and I didn't also find anything.
But the best way (IMHO) is to store in the php_socket struct if the
socket is blocking or not (and update that field in the
socket_set_(non)block() functions). It also saves the fcntl syscall on
nix systems.
------------------------------------------------------------------------
[2005-11-04 19:30:44] mike@php.net
Here's a possible patch, but Wez probably knows better if there's a way
to tell if a windows socket is in blocking mode...
Index: sockets.c
===================================================================
RCS file: /repository/php-src/ext/sockets/sockets.c,v
retrieving revision 1.171.2.2
diff -u -p -d -r1.171.2.2 sockets.c
--- sockets.c 3 Nov 2005 15:00:51 -0000 1.171.2.2
+++ sockets.c 4 Nov 2005 18:28:45 -0000
@@ -257,6 +257,12 @@ static int php_read(int bsd_socket, void
int nonblock = 0;
char *t = (char *) buf;
+/*
+ * fcntl(s, F_GETFL) will always fail for windows, and there's no way
to
+ * determine if a socket is in blocking mode to my current knowledge,
so we
+ * just omit this check; though that means we're always blocking on
win32...
+ */
+#ifndef PHP_WIN32
m = fcntl(bsd_socket, F_GETFL);
if (m < 0) {
return m;
@@ -264,6 +270,7 @@ static int php_read(int bsd_socket, void
nonblock = (m & O_NONBLOCK);
m = 0;
+#endif
set_errno(0);
------------------------------------------------------------------------
[2005-11-04 16:24:47] sniper@php.net
See also bug #35062
------------------------------------------------------------------------
[2005-09-29 16:07:34] tommyo at gmail dot com
I installed the latest windows build PHP Version 5.1.0RC2-dev and the
socket problem still exists. I get:
Warning: socket_read() [function.socket-read]: unable to read from
socket [0]: The operation completed successfully.
When I put PHP_NORMAL_READ for the read type parameter. Using the
default or PHP_BINARY_READ works just fine for the same line of code.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21197
--
Edit this bug report at http://bugs.php.net/?id=21197&edit=1
Thread (46 messages)
- #21197 [Opn->Ver]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Ver->Ana]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Ana->Bgs]: socket_read() seems to doesn't work
- #21197 [Bgs]: socket_read() seems to doesn't work
- #21197 [Bgs->Opn]: socket_read() seems to doesn't work
- #21197 [Opn->Fbk]: socket_read() seems to doesn't work
- #21197 [Fbk->Opn]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() seems to doesn't work
- #21197 [Opn->Ver]: socket_read() seems to doesn't work
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Ver->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->NoF]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [NoF->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Asn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Asn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Fbk]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [NoF->Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn]: socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Opn->Fbk]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Fbk->Ver]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Ver->Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Com]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
- #21197 [Asn->Csd]: [PATCH] socket_read() outputs error with PHP_NORMAL_READ
| « previous | php.bugs (#89778) | next » |
|---|