---
title: "keepalive(idleTimeInSeconds:count:intervalInSeconds:)"
framework: network
role: symbol
role_heading: Instance Method
path: "network/tcp/keepalive(idletimeinseconds:count:intervalinseconds:)"
---

# keepalive(idleTimeInSeconds:count:intervalInSeconds:)

Enable TCP keepalives.

## Declaration

```swift
func keepalive(idleTimeInSeconds: UInt32, count: UInt32, intervalInSeconds: UInt32) -> TCP
```

## Parameters

- `idleTimeInSeconds`: The number of seconds of idleness to wait before keepalive probes are sent by TCP (TCP_KEEPALIVE).
- `count`: The number of keepalive probes to send before terminating.
- `intervalInSeconds`: The number of seconds of to wait before resending TCP keepalive probes (TCP_KEEPINTVL).
