#21880 [Csd->Bgs]: socket_read does not stop at line breaks
| From: | pollita@php.net | Date: | Thu, 06 Feb 2003 00:32:39 +0000 |
| Subject: | #21880 [Csd->Bgs]: socket_read does not stop at line breaks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32254@lists.php.net to get a copy of this message | ||
ID: 21880
Updated by: pollita@php.net
Reported By: talmage@usi-rpg.com
-Status: Closed
+Status: Bogus
Bug Type: Sockets related
Operating System: Linux
PHP Version: 4.3.0
New Comment:
Not Bug => Bogus.
Just dots the 'i's and crosses the 't's for statistics...
Previous Comments:
------------------------------------------------------------------------
[2003-02-05 17:14:25] talmage@usi-rpg.com
Well then, allow me to take my foot out of my mouth....I have been
unable to recreate this error now, using the exact same script as I had
before (the one that didnt work) now works.....
Thanks...and sorry for the confusion.
------------------------------------------------------------------------
[2003-02-05 13:29:46] pollita@php.net
I've attempted to recreate this error under linux, win32, and irix and
have gotten expected results each time. (socket_read returns after
receiving a \n)
Can you provide a full and complete script which exhibits this
behavior? ((As short and simple as possible while still reliably
reproducing the bug))
------------------------------------------------------------------------
[2003-01-25 18:30:24] talmage@usi-rpg.com
I followed the instructions on all the manuals and tried searching the
inet, but couldent find anything that solved this.
I have a socket that is supposed to read from a client (this is a smtpd
server-type script)..
When I use
while ($line = socket_read($my_socket,2048,PHP_NORMAL_READ)) {
stuff
}
I can connect to this server via win32 putty, and it will break on line
breaks. But when using Linux telnet and trying to get other smtpd's to
send to it, they would have to send 2048 bytes to get stuff to execute
once.
To make sure they were sending \r or \n I made the socket read go byte
by byte and assemble a string, checking for \n or \r
while($tstr = socket_read($connection,1)) {
if (($tstr != chr(13)) && ($tstr != chr(10)))
{
$buf .= $tstr;
continue;
}
^^Example of my byte-by-byte checker
It does find \r and \n in the strings and I am able to gte my server to
work...
Would be nice if the built in function socket_read would really break
on \n or \r.
If more information is needed, please ask....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21880&edit=1