---
title: listenForConnections
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/netservice/options/listenforconnections
---

# listenForConnections

## Declaration

```swift
static var listenForConnections: NetService.Options { get }
```

## Discussion

Discussion Specifies that a TCP listener should be started for both IPv4 and IPv6 on the port specified by this service. If the listening port can’t be opened, the service calls its delegate’s netService(_:didNotPublish:) method to report the error. The listener supports only TCP connections. If the service’s type does not end with _tcp, publication fails with NetService.ErrorCode.badArgumentError. Whenever a client connects to the listening socket, the service calls its delegate’s netService(_:didAcceptConnectionWith:outputStream:) method with a pair of NSStream objects.

## See Also

### Constants

- [noAutoRename](foundation/netservice/options/noautorename.md)
