#36109 [Opn->Csd]: socket_sendto throws error
| From: | nicobn@php.net | Date: | Sat, 21 Jul 2007 17:55:19 +0000 |
| Subject: | #36109 [Opn->Csd]: socket_sendto throws error | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377094@lists.php.net to get a copy of this message | ||
ID: 36109
Updated by: nicobn@php.net
Reported By: mike at normi dot net
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: *
PHP Version: 5.1.2
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2006-01-24 00:08:25] tony2001@php.net
If sendto is used on a connection-mode (SOCK_STREAM,SOCK_SEQPACKET)
socket, the parameters to and tolen are ignored (and the error EISCONN
may be returned when they are not NULL and 0), and the error
ENOTCONN is returned when the socket was not actually connected.
(c) man sendto
Looks like we need a better example in the docs, that actually works.
Reclassified as docu problem.
------------------------------------------------------------------------
[2006-01-20 22:03:10] sniper@php.net
The example doesn't work for me either. (on linux)
I get "broken pipe" error..
------------------------------------------------------------------------
[2006-01-20 21:02:55] mike at normi dot net
Description:
------------
The socket_sendto function doesn't seem to work. Even with the example
code from the manual it throws an error. Any thoughts on this?
phpinfo() @ http://hlstatsx.onlydutch.nl/test.php
Result test script from manual @ http://hlstatsx.onlydutch.nl/test2.php
Reproduce code:
---------------
<?php
$sh = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (socket_bind($sh, '127.0.0.1', 4242)) {
echo "Socket bound correctly";
}
$buf = 'Test Message';
$len = strlen($buf);
if (socket_sendto($sh, $buf, $len, 0x100, '192.168.0.2', 4242) !==
false) {
echo "Message sent correctly";
}
socket_close($sh);
?>
Expected result:
----------------
Socket bound correctly
Message sent correctly
Actual result:
--------------
Socket bound correctly
Warning: socket_sendto() [function.socket-sendto]: unable to write to
socket [0]: The attempted operation is not supported for the type of
object referenced. in
D:\Home\LocalUser\onlydutch\sites\clanhost.nl\onlydutch\HTML\test2.php
on line 8
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36109&edit=1