<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Event",
  "identifier" : "/documentation/Event/SocketAddress/ipv6(_:port:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Event"
    ],
    "preciseIdentifier" : "s:5Event13SocketAddressV4ipv6_4portACSS_s6UInt16VtKFZ"
  },
  "title" : "ipv6(_:port:)"
}
-->

# ipv6(_:port:)

Creates an IPv6 socket address from a colon-notation string.

```
static func ipv6(_ host: String, port: UInt16) throws -> SocketAddress
```

## Parameters

`host`

A numeric IPv6 address such as `"::1"` or `"2001:db8::1"`. DNS names are
**not** accepted; IPv4-mapped IPv6 (`"::ffff:192.0.2.1"`) is accepted per
[RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2).

`port`

A port number in host byte order (1-65535).

## Return Value

A ready-to-use `SocketAddress` backed by `sockaddr_in6`.

## Discussion> Throws: ``doc://Event/documentation/Event/SocketError/invalidAddress(_:)`` if `inet_pton(3)` rejects `host`.

> SeeAlso: ``doc://Event/documentation/Event/SocketAddress/ipv4(_:port:)``, ``doc://Event/documentation/Event/SocketAddress/anyIPv4(port:)``.