libguac 1.6.0
 
Loading...
Searching...
No Matches
tcp.h File Reference

Provides convenience functions for establishing low-level TCP connections. More...

Go to the source code of this file.

Functions

int guac_tcp_connect (const char *hostname, const char *port, const int timeout)
 Given a hostname or IP address and port, attempt to connect to that system, returning the file descriptor of an open socket if the connection succeeds, or a negative value if it fails.
 

Detailed Description

Provides convenience functions for establishing low-level TCP connections.

Function Documentation

◆ guac_tcp_connect()

int guac_tcp_connect ( const char * hostname,
const char * port,
const int timeout )

Given a hostname or IP address and port, attempt to connect to that system, returning the file descriptor of an open socket if the connection succeeds, or a negative value if it fails.

The returned file descriptor must eventually be freed with a call to close(). If this function fails, guac_error will be set appropriately.

Parameters
hostnameThe hostname or IP address to which to attempt connections.
portThe TCP port to which to attempt to connect.
timeoutThe number of seconds to try the TCP connection before timing out.
Returns
A valid socket if the connection succeeds, or a negative integer if it fails.