socket

(4.0.2 - 4.0.6 only)

socket -- Create a socket (endpoint for communication)

Description

int socket (int domain, int type, int protocol)

Attenzione

Questa funzione è SPERIMENTALE. Ovvero, il comportamento di questa funzione, il nome di questa funzione, in definitiva TUTTO ciò che è documentato qui può cambiare nei futuri rilasci del PHP SENZA PREAVVISO. Siete avvisati, l'uso di questo modulo è a vostro rischio.

Creates a communication endpoint (a socket), and returns a descriptor to the socket.

The domain parameter sets the domain. Currently, AF_INET and AF_UNIX are understood.

The type parameter selects the socket type. This is one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, SOCK_RAW, SOCK_RDM, or SOCK_PACKET.

protocol sets the protocol.

Returns a valid socket descriptor on success, or a negative error code on failure. This code may be passed to strerror() to get a textual explanation of the error.

For more information on the usage of socket(), as well as on the meanings of the various parameters, see the Unix man page socket (2).

See also accept_connect(), bind(), connect(), listen(), strerror(), and socket_get_status().