XCVII. Socket functions

Úvod

Varování

Toto rozšíření je EXPERIMENTÁLNÍ . Chování tohoto rozšíření , názvy funkcí a všechno ostatní , co je zde zdokumentováno , se v budoucích verzích PHP může bez ohlášení změnit . Berte to v úvahu a používejte tento modul na vlastní nebezpečí .

Požadavky

Tyto funkce jsou k dispozici jako součást standardního modulu , který je vždy dostupný .

Instalace

Konfigurace běhu

Toto rozšíření nemá definováno žádné konfigurační direktivy .

Typy prostředků

Toto rozšíření nemá definován žádný typ prostředku ( resource ) .

Předdefinované konstanty

Tyto konstanty jsou definovány tímto rozšířením a budou k dispozici pouze tehdy , bylo-li rozšíření zkompilováno společně s PHP nebo dynamicky zavedeno za běhu .

AF_UNIX ( integer )

AF_INET ( integer )

SOCK_STREAM ( integer )

SOCK_DGRAM ( integer )

SOCK_RAW ( integer )

SOCK_SEQPACKET ( integer )

SOCK_RDM ( integer )

MSG_OOB ( integer )

MSG_WAITALL ( integer )

MSG_PEEK ( integer )

MSG_DONTROUTE ( integer )

SO_DEBUG ( integer )

SO_REUSEADDR ( integer )

SO_KEEPALIVE ( integer )

SO_DONTROUTE ( integer )

SO_LINGER ( integer )

SO_BROADCAST ( integer )

SO_OOBINLINE ( integer )

SO_SNDBUF ( integer )

SO_RCVBUF ( integer )

SO_SNDLOWAT ( integer )

SO_RCVLOWAT ( integer )

SO_SNDTIMEO ( integer )

SO_RCVTIMEO ( integer )

SO_TYPE ( integer )

SO_ERROR ( integer )

SOL_SOCKET ( integer )

PHP_NORMAL_READ ( integer )

PHP_BINARY_READ ( integer )

SOL_TCP ( integer )

SOL_UDP ( integer )

Socket Errors

Poznámka :










Příklady

Příklad 1 .














Příklad 2 .






Obsah
socket_accept -- Accepts a connection on a socket
socket_bind -- Binds a name to a socket
socket_clear_error -- Clears the error on the socket or the last error code
socket_close -- Closes a socket resource
socket_connect -- Initiates a connection on a socket
socket_create_listen -- Opens a socket on port to accept connections
socket_create_pair -- Creates a pair of indistinguishable sockets and stores them in fds.
socket_create -- Create a socket (endpoint for communication)
socket_get_option -- Gets socket options for the socket
socket_getpeername -- Queries the remote side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type.
socket_getsockname -- Queries the local side of the given socket which may either result in host/port or in a UNIX filesystem path, dependent on its type.
socket_iovec_add -- Adds a new vector to the scatter/gather array
socket_iovec_alloc -- ...]) Builds a 'struct iovec' for use with sendmsg, recvmsg, writev, and readv
socket_iovec_delete -- Deletes a vector from an array of vectors
socket_iovec_fetch -- Returns the data held in the iovec specified by iovec_id[iovec_position]
socket_iovec_free -- Frees the iovec specified by iovec_id
socket_iovec_set -- Sets the data held in iovec_id[iovec_position] to new_val
socket_last_error -- Returns the last error on the socket
socket_listen -- Listens for a connection on a socket
socket_read -- Reads a maximum of length bytes from a socket
socket_readv -- Reads from an fd, using the scatter-gather array defined by iovec_id
socket_recv -- Receives data from a connected socket
socket_recvfrom -- Receives data from a socket, connected or not
socket_recvmsg -- Used to receive messages on a socket, whether connection-oriented or not
socket_select -- Runs the select() system call on the given arrays of sockets with a timeout specified by tv_sec and tv_usec
socket_send -- Sends data to a connected socket
socket_sendmsg -- Sends a message to a socket, regardless of whether it is connection-oriented or not
socket_sendto -- Sends a message to a socket, whether it is connected or not
socket_set_nonblock -- Sets nonblocking mode for file descriptor fd
socket_set_option -- Sets socket options for the socket
socket_shutdown -- Shuts down a socket for receiving, sending, or both.
socket_strerror -- Return a string describing a socket error
socket_write -- Write to a socket
socket_writev -- Writes to a file descriptor, fd, using the scatter-gather array defined by iovec_id