Bug #14663 Updated: Empty packets as result of serialization
| From: | alindeman@php.net | Date: | Wed, 06 Feb 2002 17:45:00 +0000 |
| Subject: | Bug #14663 Updated: Empty packets as result of serialization | ||
| References: | 1 | Groups: | php.dev php.doc |
| Request: | Send a blank email to php-dev+get-79380@lists.php.net to get a copy of this message | ||
ID: 14663
Updated by: alindeman@php.net
Reported By: aragon@phat.za.net
Status: Suspended
Bug Type: Documentation problem
Operating System: Windows NT 4 sp 6a
PHP Version: 4.1.0
New Comment:
status -> suspended (waiting till it becomes un-experimental ;)
Previous Comments:
------------------------------------------------------------------------
[2002-02-06 12:43:52] alindeman@php.net
status -> suspended (waiting till it becomes un-experimental ;)
------------------------------------------------------------------------
[2001-12-22 16:22:10] jan@php.net
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.
------------------------------------------------------------------------
[2001-12-22 15:58:12] mfischer@php.net
Making a documentation problem. Valid sample still have to be written.
------------------------------------------------------------------------
[2001-12-22 15:50:49] aragon@phat.za.net
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