PHP.nl

socket_create

socket_create

Create a socket (endpoint for communication)

 **socket_create** int $domain int $type int $protocol

Creates and returns a instance, also referred to as an endpoint of communication. A typical network connection is made up of 2 sockets, one performing the role of the client, and another performing the role of the server. Socket

domain The parameter specifies the protocol family to be used by the socket. domain

type The parameter selects the type of communication to be used by the socket. type

protocol The parameter sets the specific protocol within the specified to be used when communicating on the returned socket. The proper value can be retrieved by name by using . If the desired protocol is TCP, or UDP the corresponding constants , and can also be used. protocol``domain``getprotobyname``SOL_TCP``SOL_UDP

returns a  instance on success,

or false on error. The actual error code can be retrieved by calling . This error code may be passed to to get a textual explanation of the error. socket_create``Socket``socket_last_error``socket_strerror

If an invalid or is given, defaults to and respectively and additionally emits an message. domain``type``socket_create``AF_INET``SOCK_STREAM``E_WARNING

socket_accept``socket_bind``socket_connect``socket_listen``socket_last_error``socket_strerror