---
name: "TSHostLookup"
section: "3ts"
platform: "linux"
package: "trafficserver-dev"
version: "9.2.5+ds-0+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/TSHostLookup"
---

# TSHostLookup(3ts)

TSHostLookup API function

## NAME

TSHostLookup - TSHostLookup API function

## SYNOPSIS

```
#include <ts/ts.h>
```

- ***TSAction* TSHostLookup(*TSCont* contp, const char \*hostname, size\_t namelen)**

  ## DESCRIPTION

Attempts host name resolution for the given *hostname* with length *namelen*. When a result is ready the handler of *contp* is called with the *TS\_EVENT\_HOST\_LOOKUP* event and a *TSHostLookupResult*. Use *TSHostLookupResultAddrGet()* to retrieve the resulting address from the *TSHostLookupResult*.

A call to *TSHostLookup()* may be synchronous—in which case the handler for *contp* will be called with the answer before the call to *TSHostLookup()* returns—or the call to *TSHostLookup()* may be asynchronous—in which case it returns immediately with a *TSAction*, and the handler *contp* will be called in the future. See *Actions* for guidance.

In particular, *contp* must have been created with a *TSMutex*; see *TSContCreate()*

## COPYRIGHT

2026, dev@trafficserver.apache.org
