Регистрация Войти
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Поиск по сайту
socket_sendto
(PHP 4 >= 4.1.0, PHP 5)
socket_sendto - Sends a message to a socket, whether it is connected or not int socket_sendto ( resource socket, string buf, int len, int flags, string addr [, int port] )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:
Таблица 1. possible values for flags
Пример 1. socket_sendto() Example
$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);
Смотрите также also socket_send() and socket_sendmsg().
Все функции сокетыОписание на ru2.php.net
Описание на php.ru