2 (defpackage "SB-WIN32-SOCKETS-INTERNAL"
3 (:nicknames "WIN32SOCKINT")
5 (:use "COMMON-LISP" "SB-ALIEN" "SB-EXT" "SB-C-CALL"))
7 (defpackage "SB-BSD-SOCKETS-INTERNAL"
10 (:shadowing-import-from "SB-KERNEL" with-array-data)
11 (:use "COMMON-LISP" "SB-ALIEN" "SB-EXT" "SB-C-CALL"))
13 (defpackage "SB-BSD-SOCKETS"
14 (:export socket local-socket local-abstract-socket inet-socket
15 make-local-socket make-inet-socket
16 socket-bind socket-accept socket-connect
17 socket-send socket-receive socket-recv
18 socket-name socket-peername socket-listen
19 socket-close socket-file-descriptor
20 socket-family socket-protocol socket-open-p
21 socket-type socket-make-stream get-protocol-by-name
23 get-host-by-name get-host-by-address
25 host-ent-addresses host-ent-address
26 host-ent-aliases host-ent-name
29 ;; not sure if these are really good names or not
38 ;; all socket options are also exported, by code in
43 ;; other errno-based socket errors are exported by code in
50 (:use "COMMON-LISP" "SB-BSD-SOCKETS-INTERNAL")
51 (:import-from "SB-INT" "UNSUPPORTED-OPERATOR" "FEATUREP")
55 A thinly-disguised BSD socket API for SBCL. Ideas stolen from the BSD
56 socket API for C and Graham Barr's IO::Socket classes for Perl.
58 We represent sockets as CLOS objects, and rename a lot of methods and
59 arguments to fit Lisp style more closely.
64 ;;; gethostbyname/gethostbyaddr are generally not thread safe. POSIX
65 ;;; 1003.1-2003 defines an alternative API, which is specified in the
66 ;;; RFC to be thread-safe. If it seems to be available, use it.
68 ;;; Unfortunately the manual page claims that these functions are not
69 ;;; thread-safe on OS X, but they probably can't be any worse than
70 ;;; gethostbyname and gethostbyaddr.
72 ;;; CLH: getaddrinfo seems to be broken is broken on x86-64/darwin
74 (let ((addr (sb-alien::find-dynamic-foreign-symbol-address "getaddrinfo")))
76 (pushnew :sb-bsd-sockets-addrinfo *features*)))