---
name: "Ns_ConnGetStatus"
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_ConnGetStatus"
---

# Ns\_ConnGetStatus(3aolserver)

Routines to manage the HTTP response status

```

```

## NAME

Ns\_ConnGetStatus, Ns\_ConnSetStatus - Routines to manage the HTTP response status

## SYNOPSIS

```
#include "ns.h"

int
Ns_ConnGetStatus(conn)

void
Ns_ConnSetStatus(conn, status)
```

## ARGUMENTS

- Ns\_Conn *conn* (in)

  Pointer to open connection.

- int *status* (in)

  Integer HTTP status code.

  ```

  ```

## DESCRIPTION

These routines manage the HTTP response code sent to the client in a later call to **Ns\_ConnFlush** or **Ns\_ConnFlushDirect**. Higher level routines such as the **Ns\_ConnReturn** functions normally call these routines automatically using standard HTTP status codes and the **Ns\_ConnQueueHeaders** routine can be used to set the status code for lower level code which bypasses **Ns\_ConnFlush**.

- int **Ns\_ConnGetStatus**(*conn*)

  Return the current HTTP status to be sent.

- int **Ns\_ConnSetStatus**(*conn, status*)

  Set the status code to be sent in the response, for example, 200 for a normal "OK" response.  A later call to **Ns\_ConnFlush** will construct the appropriate HTTP response including the given status with the cooresponding string status code.

## EXAMPLES

The following example demonstrates setting an odd status code followed by a call to **Ns\_ConnFlushDirect** to send some data:

```
	Ns_ConnSetStatus(conn, 600);
	Ns_ConnSetType(conn, "text/plain");
	Ns_ConnFlushDirect(conn, "hello", 5, 0);
```

The following should provide similar results:

```
	Ns_ConnSetRequiredHeaders(conn, "text/plain", 5);
	Ns_ConnQueueHeaders(conn, 600);
	Ns_ConnPuts(conn, "hello");
	Ns_ConnClose(conn);
```

## SEE ALSO

Ns\_ConnGetType(3), Ns\_ConnSetType(3), Ns\_ConnFlush(3), Ns\_ConnFlushDirect(3), [Ns\_ConnSetRequiredHeaders(3)](/Ns_ConnSetRequiredHeaders/3.md), [Ns\_ConnQueueHeaders(3)](/Ns_ConnQueueHeaders/3.md), ns\_conn(n)

## KEYWORDS

connectionn, response, status
