Home > PHP > Function > Sockets > socket_create()

socket_create()

socket_create - Create a socket (endpoint for communication)

Syntax

resource socket_create ()

Arguments

-

Description

Creates and returns a socket resource, 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.

Version

PHP 4.1.0, 5

Return value

socket_create() returns a socket resource on success, or FALSE on 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.