source: project/wiki/eggref/4/unix-sockets @ 13306

Last change on this file since 13306 was 13306, checked in by felix winkelmann, 12 years ago

added xlib page and removed download links

File size: 3.3 KB
Line 
1[[tags: egg]]
2
3== unix-sockets
4
5[[toc:]]
6
7=== Description
8
9Simple access to UNIX domain sockets.
10
11=== Author
12
13[[felix winkelmann]]
14
15=== Requirements
16
17[[easyffi]]
18
19=== Documentation
20
21The interface is similar to the builtin TCP socket functionality in CHICKEN.
22
23<procedure>(unix-listen PATHNAME [BACKLOG])</procedure>
24
25Creates a socket listener object. {{PATHNAME}} gives the name of the
26file that represents the connection. {{BACKLOG}} specifies how many
27pending connections are allowed and defaults to 10.
28
29<procedure>(unix-listener? X)</procedure>
30
31Returns {{#t}} if {{X}} is a unix socket listener object, or {{#f}} otherwise.
32
33<procedure>(unix-close LISTENER)</procedure>
34
35Closes the socket associated with the listener object.
36
37<procedure>(unix-accept LISTENER)</procedure>
38
39Waits for a connection from a client and returns two values: an input-
40and output-port which can be used to communicate with the connecting
41process. Calling {{unix-accept}} does not block other threads from
42running.
43
44<procedure>(unix-accept-ready? LISTENER)</procedure>
45
46Returns {{#t}} if a {{unix-accept}} for this listener would not block the current thread, or {{#f}}
47otherwise.
48
49
50<procedure>(unix-connect PATHNAME)</procedure>
51
52Connects to the socket given in {{PATHNAME}} and returns two values: an input- and output-port
53which allow communication with the server.
54
55<procedure>(unix-listener-fileno LISTENER)</procedure>
56
57Returns the file-descriptor of the socket associated with the given listener object.
58
59<procedure>(unix-listener-path LISTENER)</procedure>
60
61Returns the pathname of the socket associated with the given listener object.
62
63=== Changelog
64
65* 1.3 Applied bugfix by Shawn Wagner
66* 1.2 Added include for sys/time.h, which is needed on some systems [Thanks to Kon Lovett]
67* 1.1 Replaced use of {{(end-of-file)}} with {{#!eof}}
68* 1.0 Initial release
69
70=== License
71
72  Copyright (c) 2005, Felix L. Winkelmann
73  All rights reserved.
74 
75  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
76  conditions are met:
77 
78    Redistributions of source code must retain the above copyright notice, this list of conditions and the following
79      disclaimer.
80    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
81      disclaimer in the documentation and/or other materials provided with the distribution.
82    Neither the name of the author nor the names of its contributors may be used to endorse or promote
83      products derived from this software without specific prior written permission.
84 
85  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
86  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
87  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
88  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
89  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
90  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
91  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
92  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
93  POSSIBILITY OF SUCH DAMAGE.
Note: See TracBrowser for help on using the repository browser.