.\" This man page is automatically generated using .\" kayadoc2man from the Kaya development tools and the -xmldocs compile .\" option. Editing it directly is not encouraged. .\" It is under the same license as the source .k file that it was .\" generated from. .TH "Sockets.socketPair" "3kaya" "August 2014" "Kaya" "Kaya module reference" .SH "NAME" Sockets::socketPair \- Create a joined pair of sockets .SH "SYNOPSIS" .B Pair socketPair( \fI\fP .B ")" .SH "DESCRIPTION" .PP This function creates a pair of sockets that can be used for bi-directional communication. The most common use of this is for setting up communications between a process and its .B "Posix.fork"(3kaya) ()ed child - each process closes one of the sockets after the fork. .IP "" -4 sockets = socketPair(); pid = fork(); if (pid == 0) { // child process close(sockets.fst); // do something } else { close(sockets.snd); // do something else } .SH "AUTHORS" Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/ .SH LICENSE The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation. .SH "RELATED" .PD 0 .PP .B "Sockets.Socket"(3kaya) .PP .B "Sockets.close"(3kaya) .PP .B "Posix.fork"(3kaya) .PD 0.4v