---
name: "Ns_ConnClose"
section: "3aolserver"
platform: "linux"
package: "aolserver4-dev"
version: "4.5.1-18.1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Ns_ConnClose/3aolserver"
---

# Ns\_ConnClose(3aolserver)

Close an open connection

```

```

## NAME

Ns\_ConnClose - Close an open connection

## SYNOPSIS

```
#include "ns.h"

int
Ns_ConnClose(conn)
```

## ARGUMENTS

- Ns\_Conn *conn* (in)

  Pointer to open connection.

  ```

  ```

## DESCRIPTION

This function calls the connection's communication driver to close the connection if it is not already closed.  It always returns NS\_OK.

If the connection is marked for keep-alive, the underlying connection is not actually closed but instead returned to the driver thread to process additional requests, if any.  Connections are automatically marked for keep-alive by setting the *NS\_CONN\_KEEPALIVE* flag if the client supports it by sending an appropriate *connection-keepalive* header.  Keep alive can be disabled before a call to **Ns\_ConnClose** with the **Ns\_ConnSetKeepAliveFlag** routine with a zero value for the *flag* argument.

## SEE ALSO

Ns\_ConnSetKeepAliveFlag(3), Ns\_ConnGetKeepAliveFlag(3), Ns\_ConnFlush(3)

## KEYWORDS

connection, close, keep-alive
