---
name: "TSIpStringToAddr"
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/TSIpStringToAddr"
---

# TSIpStringToAddr(3ts)

TSIpStringToAddr API function

## NAME

TSIpStringToAddr - TSIpStringToAddr API function

## SYNOPSIS

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

- ***TSReturnCode* TSIpStringToAddr(const char \*str, int str\_len, sockaddr \*addr)**

  ## DESCRIPTION

*str* is expected to be an explicit address, not a hostname.  No hostname resolution is done. This attempts to recognize and process a port value if present. It is set appropriately, or to zero if no port was found or it was malformed.

It is intended to deal with the brackets that can optionally surround an IP address (usually IPv6) which in turn are used to differentiate between an address and an attached port. E.g.

```

```

\[FE80:9312::192:168:1:1\]:80

## RETURN VALUES

It returns *TS\_SUCCESS* on success, or *TS\_ERROR* on failure.

## NOTES

This API may be changed in the future version since it is experimental.

## COPYRIGHT

2026, dev@trafficserver.apache.org
