|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-12-01 15:02 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 20:00:01 2025 UTC |
Description: ------------ When executing the script below an error occurs. A trace with strace show that the struct sockaddr of the system call sendto is uninitialized (or badly initialized) : sendto(3, "Test Message", 12, 0, {sa_family=0x45a0 /* AF_??? */, sa_data="<\10\20\0\0\0\20\0\0\0\250\376\343\277"}, 16) = -1 EINVAL (Invalid argument) Reproduce code: --------------- <? $sh = socket_create(AF_INET6,SOCK_DGRAM,0); if (socket_bind($sh, '::1', 4242)) { echo "Socket ok\n"; } $buf = 'Test Message'; $len = strlen($buf); if (socket_sendto($sh, $buf, $len, 0x00, '::1', 4000) !== FALSE) { echo "Message sent\n"; } socket_close($sh); ?> Expected result: ---------------- an IPv6 UDP datagram should be sent to the IPv6 loopback address. Actual result: -------------- Warning: socket_sendto(): unable to write to socket [22]: Invalid argument in /tmp/toto.php on line 12