IP_ConnectToService

Cogent API and Utilities: Version 4.1
Prev |  | Next

# `IP_ConnectToService`

`IP_ConnectToService` -- like `IP_ConnectToPort`, but uses the service name.

## Syntax

``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`

Prev | Home | Next
`IP_ConnectToPort` | Up | `IP_DetachPhotonMainloop`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.