1Sockets.socketPair(3kaya)    Kaya module reference   Sockets.socketPair(3kaya)
2
3
4

NAME

6       Sockets::socketPair - Create a joined pair of sockets
7

SYNOPSIS

9       Pair<Socket, Socket> socketPair( )
10

DESCRIPTION

12       This  function creates a pair of sockets that can be used for bi-direcā€
13       tional communication. The most common use of this  is  for  setting  up
14       communications  between a process and its Posix.fork (3kaya) ()ed child
15       - each process closes one of the sockets after the fork.
16
17
18    sockets = socketPair();
19    pid = fork();
20    if (pid == 0) {
21    // child process
22      close(sockets.fst);
23      // do something
24    } else {
25      close(sockets.snd);
26      // do something else
27    }
28

AUTHORS

30       Kaya  standard  library  by  Edwin  Brady,  Chris  Morris  and   others
31       (kaya@kayalang.org). For further information see http://kayalang.org/
32

LICENSE

34       The  Kaya  standard  library  is free software; you can redistribute it
35       and/or modify it under the terms  of  the  GNU  Lesser  General  Public
36       License  (version  2.1  or  any later version) as published by the Free
37       Software Foundation.
38
40       Sockets.Socket (3kaya)
41       Sockets.close (3kaya)
42       Posix.fork (3kaya)
43
44
45
46Kaya                             December 2010       Sockets.socketPair(3kaya)
Impressum