public function connect($address, $port = 0)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($address, $port) {
                return @socket_connect($resource, $address, $port);
            }
        );
    }
public function connect($address, $port = 0)
    {
        return static::exceptionOnFalse(
            $this->resource,
            function ($resource) use ($address, $port) {
                return @socket_connect($resource, $address, $port);
            }
        );
    }
public function connect ( $ address , $ port = 0 ) { return static :: exceptionOnFalse ( $ this -> resource , function ( $ resource ) use ( $ address , $ port ) { return @ socket_connect ( $ resource , $ address , $ port ) ; } ) ; }
Connect to a socket.

<p>Initiate a connection to the address given using the current php socket resource, which must be a valid
socket resource created with <code>create()</code>.

@param string $address <p>The address parameter is either an IPv4 address in dotted-quad notation (e.g.
<code>127.0.0.1</code>) if the socket is AF_INET, a valid IPv6 address (e.g. <code>::1</code>) if IPv6 support
is enabled and the socket is AF_INET6, or the pathname of a Unix domain socket, if the socket family is AF_UNIX.
</p>
@param int    $port    <p>(Optional) The port parameter is only used and is mandatory when connecting to an AF_INET or
an AF_INET6 socket, and designates the port on the remote host to which a connection should be made.</p>

@throws Exception\SocketException If the connect was unsuccessful or if the socket is non-blocking.

@see Socket::bind()
@see Socket::listen()
@see Socket::create()

@return bool <p>Returns <code>true</code> if the connect was successful.
Connect to a socket .