Programming Perl

Programming PerlSearch this book
Previous: 3.2.151 socketChapter 3
Functions
Next: 3.2.153 sort
 

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.


Previous: 3.2.151 socketProgramming PerlNext: 3.2.153 sort
3.2.151 socketBook Index3.2.153 sort