home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


3.2.152 socketpair

socketpair 

SOCKET1

, 

SOCKET2

, 

DOMAIN

, 

TYPE

, 

PROTOCOL

This function creates an unnamed pair of sockets in the specified domain, of the specified type. DOMAIN , TYPE , and PROTOCOL are specified the same as for socketpair (2). If socketpair (2) is unimplemented, invoking this function yields a fatal error. The function returns true if successful.

This function is typically used just before a fork . One of the resulting processes should close SOCKET1 , and the other should close SOCKET2 . You can use these sockets bidirectionally, unlike the filehandles created by the pipe function.