Include files:
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
System call:
connect(s,addr,addrlen)
int s;
struct sockaddr*addr;
int addrlen;
Parameter
s
socket descriptor of local
socket
addr
pointer to the socket
address
addrlen
length of address
Function result: 0 if connect is successful, –1 if failure occurs.
When to Specify a Default Socket Address
The client or server process should specify a default socket address after
sockets are bound.
Chapter 5
Advanced Topics for Internet Datagram Sockets
Specifying a Default Socket Address
Description of
Contents
INPUT Value
socket descriptor of socket
requesting default peer
address
pointer to socket address
of the socket to be the
peer
length of address pointed
to by addr
113