Rechercher une page de manuel
Sockets.socketPair.3kaya
Langue: en
Version: March 2009 (fedora - 05/07/09)
Section: 3 (Bibliothèques de fonctions)
NAME
Sockets::socketPair - Create a joined pair of socketsSYNOPSIS
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)
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre