IP_ConnectToService

IP_ConnectToService — like IP_ConnectToPort, but uses the service name.

Syntax

#include <cogent.h>
int IP_ConnectToService(char*  host,
 char*  service);

Arguments

host

A host name.

service

The service name, as found in /etc/services.

Returns

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

Description

This function looks up the service name, resolving it to a port number before calling IP_ConnectToPort.

See Also

Working with TCP/IP, IP_ListenToService, IP_ConnectToPort