Sockets.socketPair(3kaya)
NAME
Sockets::socketPair - Create a joined pair of sockets
SYNOPSIS
Pair<Socket, Socket> socketPair( )
DESCRIPTION
- 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 Posix.fork (3kaya) ()ed child
- each process closes one of the sockets after the fork.
- sockets = socketPair();
pid = fork();
if (pid == 0) {
// child process - close(sockets.fst);
// do something - } else {
- close(sockets.snd);
// do something else - }
AUTHORS
Kaya standard library by Edwin Brady, Chris Morris and others
(kaya@kayalang.org). For further information see http://kayalang.org/
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.
RELATED
- Sockets.Socket (3kaya)
Sockets.close (3kaya)
Posix.fork (3kaya)