TSVConnFdCreate

Create a TSVConn from a socket.

Synopsis

#include <ts/ts.h>

TSVConn TSVConnFdCreate(int fd)

Description

TSVConnFdCreate() accepts a network socket :arg:`fd` and returns a new TSVConn constructed from the socket. The socket descriptor must be an already connected socket. It will be placed into non-blocking mode.

Return Values

On success, the returned TSVConn object owns the socket and the caller must not close it. If TSVConnFdCreate() fails, NULL is returned, the socket is unchanged and the caller must close it.

Examples

The example below is excerpted from example/intercept/intercept.cc in the Traffic Server source distribution. It demonstrates how to use TSVConnFdCreate() to construct a TSVConn from a connected socket.

See Also

TSAPI(3ts)