#36109 [Opn]: socket_sendto throws error

From: Date: Mon, 23 Jan 2006 23:08:26 +0000
Subject: #36109 [Opn]: socket_sendto throws error
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969371730@lists.php.net to get a copy of this message
ID: 36109 Updated by: tony2001@php.net Reported By: mike at normi dot net Status: Open -Bug Type: Sockets related +Bug Type: Documentation problem Operating System: * PHP Version: 5.1.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc (#969371730) next »