|
socket_recvfrom(PHP 4 >= 4.1.0, PHP 5) socket_recvfrom — Receives data from a socket whether or not it is connection-oriented Описание
int socket_recvfrom
( resource $socket
, string &$buf
, int $len
, int $flags
, string &$name
[, int &$port
] )
The socket_recvfrom() function receives len bytes of data in buf from name on port port (if the socket is not of type AF_UNIX) using socket. socket_recvfrom() can be used to gather data from both connected and unconnected sockets. Additionally, one or more flags can be specified to modify the behaviour of the function. The name and port must be passed by reference. If the socket is not connection-oriented, name will be set to the internet protocol address of the remote host or the path to the UNIX socket. If the socket is connection-oriented, name is NULL. Additionally, the port will contain the port of the remote host in the case of an unconnected AF_INET or AF_INET6 socket. Список параметров
Возвращаемые значенияsocket_recvfrom() returns the number of bytes received, or FALSE if there was an error. The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error. Примеры
Пример #1 socket_recvfrom() example
<?php This example will initiate a UDP socket on port 1223 of 127.0.0.1 and print at most 12 characters received from a remote host. Список изменений
Смотрите также
|
|||||||||||||||