Date: 12/22/01
- Next message: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Previous message: Slawomir Pucia: "[PHP-DOC] cvs: phpdoc /en/functions mysql.xml"
- Next in thread: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Reply: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 14663
Updated by: jan
Reported By: aragon <email protected>
Old Summary: socket_read() doesn't function as documented
Old Status: Open
Status: Analyzed
Bug Type: Documentation problem
Old Operating System: FreeBSD 4.4
Operating System: Windows NT 4 sp 6a
PHP Version: 4.1.0
New Comment:
the manual page is marked as "EXPERIMENTAL". so waiting for the extension to become stable wil be the best. fixing the example now just to change it again tomorrow is useless.
Previous Comments:
------------------------------------------------------------------------
[2001-12-22 15:58:12] mfischer <email protected>
Making a documentation problem. Valid sample still have to be written.
------------------------------------------------------------------------
[2001-12-22 15:50:49] aragon <email protected>
Example code copy/pasted from http://www.php.net/manual/en/html/ref.sockets.html :
<?php
error_reporting (E_ALL);
echo "<h2>TCP/IP Connection</h2>\n";
/* Get the port for the WWW service. */
$service_port = getservbyname ('www', 'tcp');
/* Get the IP address for the target host. */
$address = gethostbyname ('www.php.net');
/* Create a TCP/IP socket. */
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror ($socket) . "\n";
} else {
"socket_create() successful: " . socket_strerror ($socket) . "\n";
}
echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect ($socket, $address, $service_port);
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
} else {
echo "OK.\n";
}
$in = "HEAD / HTTP/1.0\r\n\r\n";
$out = '';
echo "Sending HTTP HEAD request...";
socket_write ($socket, $in, strlen ($in));
echo "OK.\n";
echo "Reading response:\n\n";
while (socket_read ($socket, $out, 2048)) {
echo $out;
}
echo "Closing socket...";
socket_close ($socket);
echo "OK.\n\n";
?>
When run :
<h2>TCP/IP Connection</h2>
<br>
<b>Warning</b>: socket_strerror() expects parameter 1 to be long, resource given in <b>/usr/home/aragon/squeakbot/test2</b> on line <b>18</b><br>
Attempting to connect to '209.61.157.217' on port '80'...OK.
Sending HTTP HEAD request...OK.
Reading response:
<br>
<b>Warning</b>: socket_read() expects parameter 2 to be long, string given in <b>/usr/home/aragon/squeakbot/test2</b> on line <b>38</b><br>
Closing socket...OK.
Regards,
Aragon
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14663&edit=1
- Next message: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Previous message: Slawomir Pucia: "[PHP-DOC] cvs: phpdoc /en/functions mysql.xml"
- Next in thread: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Reply: Markus Fischer: "[PHP-DOC] Re: [PHP-DEV] Bug #14663 Updated: Empty packets as result of serialization"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

