> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/honojs/hono/llms.txt
> Use this file to discover all available pages before exploring further.

# Connection Info Helper

> Get connection information from requests

The Connection Info Helper provides utilities for retrieving connection information such as remote address and IP.

## Import

```typescript theme={null}
import { getConnInfo } from 'hono/conninfo'
```

## Functions

### getConnInfo()

Get connection information from the request.

```typescript theme={null}
function getConnInfo(c: Context): ConnInfo
```

<ParamField path="c" type="Context" required>
  The context object
</ParamField>

<ResponseField name="return" type="ConnInfo">
  Connection information object
</ResponseField>

**Example**

```typescript theme={null}
import { getConnInfo } from 'hono/conninfo'

app.get('/', (c) => {
  const info = getConnInfo(c)
  return c.json({
    remote: info.remote,
  })
})
```

## Types

```typescript theme={null}
type ConnInfo = {
  remote: NetAddrInfo
}

type NetAddrInfo = {
  address?: string
  addressType?: AddressType
  port?: number
  family?: 'IPv4' | 'IPv6'
  transport?: 'tcp' | 'udp'
}

type AddressType = 'IPv4' | 'IPv6' | 'unknown'
```

## Adapter-Specific Usage

```typescript theme={null}
import { getConnInfo } from 'hono/adapter'

// Cloudflare Workers
import { getConnInfo } from 'hono/cloudflare-workers'
const info = getConnInfo(c)
console.log(info.remote.address) // From cf-connecting-ip header

// Deno
import { getConnInfo } from 'hono/deno'
const info = getConnInfo(c)
console.log(info.remote.port) // Server port

// Bun
import { getConnInfo } from 'hono/bun'
const info = getConnInfo(c)

// Node.js
import { getConnInfo } from 'hono/node-server'
const info = getConnInfo(c)
```
