IP_ConnectToPort

IP_ConnectToPort — resolves a host name and connects to a port.

Syntax

#include <cogent.h>

int IP_ConnectToPort(char* host, int port);

Arguments

host

A host name.

port

A port number.

Returns

A file descriptor (socket) on success, or -1 on failure and errno is set.

Description

This function resolves the host name, which may be either a fully qualified host name or an IP address as an ASCII string containing a dotted quad. It then attempts to connect to the specified port on that host.

See Also

Working with TCP/IP, IP_ListenToService, IP_ConnectToService