ID:               14663
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

status -> suspended (waiting till it becomes un-experimental ;)


------------------------------------------------------------------------

[2001-12-22 16:22:10] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

Making a documentation problem. Valid sample still have to be written.

------------------------------------------------------------------------

[2001-12-22 15:50:49] [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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to