PHP Manual
This manual is provided as a courtesy. It is not an official source. Please check php.net for updated information.
(PHP 4 >= 4.1.0, PHP 5)
The function socket_sendto() sends len bytes from buf through the socket socket to the port at the address addr
The value of flags can be one of the following:
Table 1. possible values for flags
Example 1. socket_sendto() Example
<?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);?>
See also socket_send() and socket_sendmsg().