Create and connect to a socket from a given addrinfo

- « socket_addrinfo_bind

- socket_addrinfo_explain »

- PHP Manual
- Socket Functions
- Create and connect to a socket from a given addrinfo

# socket_addrinfo_connect

(PHP 7 >= 7.2.0, PHP 8)

socket_addrinfo_connect — Create and connect to a socket from a given addrinfo

### Description

socket_addrinfo_connect(AddressInfo `$address`): Socket|false

Create a Socket instance, and connect it to the provided AddressInfo instance. The return value of this function may be used with the rest of the socket functions.

### Parameters

`address`

  AddressInfo instance created from socket_addrinfo_lookup().

### Return Values

Returns a Socket instance on success or `false` on failure.

### Changelog

Version | Description
--- | ---
8.0.0 | On success, this function returns a Socket instance now; previously, a resource was returned.
8.0.0 | `address` is an AddressInfo instance now; previously, it was a resource.

### See Also

- socket_addrinfo_bind() - Create and bind to a socket from a given addrinfo
- socket_addrinfo_explain() - Get information about addrinfo
- socket_addrinfo_lookup() - Get array with contents of getaddrinfo about the given hostname