Home

Traffic Server Software Developers Kit

INKNetConnect

Initiates a network connection to a server.

Prototype

INKAction INKNetConnect (INKCont contp, unsigned int ip, int port)

Arguments

INKCont contp is the continuation to be associated with the connection.

int ip is the IP address, in network byte order, of the host to connect with.

int port is port number for the host, specified in network byte order.

Description

Opens a network connection to the host specified by ip on the port specified by port. If the connection is successfully opened, then contp is called back with the event INK_EVENT_NET_CONNECT and the new network vconnection is passed in the event data parameter. If the connection is not successful, then contp is called back with the event INK_EVENT_NET_CONNECT_FAILED.

[Note] Note

It’s possible to receive INK_EVENT_NET_CONNECT even if the connection failed because of the implementation of network sockets in the underlying operating system. There is an exception: if a plugin tries to open a connection to a port on its own host machine, then INK_EVENT_NET_CONNECT is sent only if the connection is successful. In general, however, your plugin needs to look for INK_EVENT_VCONN_WRITE_READY or INK_EVENT_VCONN_READ_READY to make sure the connection is successfully opened.

Reentrant calls are possible; i.e., the net processor can call back the user (contp) in the same call.

Returns

An INKAction object.