public static function create($domain, $type, $protocol)
    {
        $return = @socket_create($domain, $type, $protocol);

        if ($return === false) {
            throw new SocketException();
        }

        $socket = new self($return);
        $socket->domain = $domain;
        $socket->type = $type;
        $socket->protocol = $protocol;

        return $socket;
    }
public static function create($domain, $type, $protocol)
    {
        $return = @socket_create($domain, $type, $protocol);

        if ($return === false) {
            throw new SocketException();
        }

        $socket = new self($return);
        $socket->domain = $domain;
        $socket->type = $type;
        $socket->protocol = $protocol;

        return $socket;
    }
public static function create ( $ domain , $ type , $ protocol ) { $ return = @ socket_create ( $ domain , $ type , $ protocol ) ; if ( $ return === false ) { throw new SocketException ( ) ; } $ socket = new self ( $ return ) ; $ socket -> domain = $ domain ; $ socket -> type = $ type ; $ socket -> protocol = $ protocol ; return $ socket ; }
Create a socket.

<p>Creates and returns a Socket. A typical network connection is made up of two sockets, one performing the role
of the client, and another performing the role of the server.</p>

@param int $domain   <p>The domain parameter specifies the protocol family to be used by the socket.</p><p>
<code>AF_INET</code> - IPv4 Internet based protocols. TCP and UDP are common protocols of this protocol family.
</p><p><code>AF_INET6</code> - IPv6 Internet based protocols. TCP and UDP are common protocols of this protocol
family.</p><p><code>AF_UNIX</code> - Local communication protocol family. High efficiency and low overhead make
it a great form of IPC (Interprocess Communication).</p>
@param int $type     <p>The type parameter selects the type of communication to be used by the socket.</p><p>
<code>SOCK_STREAM</code> - Provides sequenced, reliable, full-duplex, connection-based byte streams. An
out-of-band data transmission mechanism may be supported. The TCP protocol is based on this socket type.</p><p>
<code>SOCK_DGRAM</code> - Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
The UDP protocol is based on this socket type.</p><p><code>SOCK_SEQPACKET</code> - Provides a sequenced,
reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is
required to read an entire packet with each read call.</p><p><code>SOCK_RAW</code> - Provides raw network
protocol access. This special type of socket can be used to manually construct any type of protocol. A common
use for this socket type is to perform ICMP requests (like ping).</p><p><code>SOCK_RDM</code> - Provides a
reliable datagram layer that does not guarantee ordering. This is most likely not implemented on your operating
system.</p>
@param int $protocol <p>The protocol parameter sets the specific protocol within the specified domain to be used
when communicating on the returned socket. The proper value can be retrieved by name by using
<code>getprotobyname()</code>. If the desired protocol is TCP, or UDP the corresponding constants
<code>SOL_TCP</code>, and <code>SOL_UDP</code> can also be used.<p><p>Some of the common protocol types</p><p>
icmp - The Internet Control Message Protocol is used primarily by gateways and hosts to report errors in
datagram communication. The "ping" command (present in most modern operating systems) is an example application
of ICMP.</p><p>udp - The User Datagram Protocol is a connectionless, unreliable, protocol with fixed record
lengths. Due to these aspects, UDP requires a minimum amount of protocol overhead.</p><p>tcp - The Transmission
Control Protocol is a reliable, connection based, stream oriented, full duplex protocol. TCP guarantees that all
data packets will be received in the order in which they were sent. If any packet is somehow lost during
communication, TCP will automatically retransmit the packet until the destination host acknowledges that packet.
For reliability and performance reasons, the TCP implementation itself decides the appropriate octet boundaries
of the underlying datagram communication layer. Therefore, TCP applications must allow for the possibility of
partial record transmission.</p>

@throws Exception\SocketException If there is an error creating the php socket.

@return Socket Returns a Socket object based on the successful creation of the php socket.
Create a socket .