#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.447 2003/06/08 05:07:12 cph Exp $
+$Id: runtime.pkg,v 14.448 2003/07/09 04:27:03 cph Exp $
Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
(parent (runtime))
(export ()
allocate-host-address
+ bind-tcp-server-socket
canonical-host-name
close-tcp-server-socket
+ create-tcp-server-socket
get-host-by-address
get-host-by-name
get-host-name
host-address-any
host-address-loopback
+ listen-tcp-server-socket
open-tcp-server-socket
open-tcp-stream-socket
open-tcp-stream-socket-channel
#| -*-Scheme-*-
-$Id: socket.scm,v 1.22 2003/06/08 03:36:11 cph Exp $
+$Id: socket.scm,v 1.23 2003/07/09 04:26:50 cph Exp $
Copyright 1996,1997,1998,1999,2001,2002 Massachusetts Institute of Technology
Copyright 2003 Massachusetts Institute of Technology
((ucode-primitive new-open-unix-stream-socket 2) filename p))))))
\f
(define (open-tcp-server-socket service #!optional host)
+ (let ((server-socket (create-tcp-server-socket)))
+ (bind-tcp-server-socket server-socket
+ service
+ (if (or (default-object? host) (not host))
+ ((ucode-primitive host-address-any 0))
+ host))
+ (listen-tcp-server-socket server-socket)))
+
+(define (create-tcp-server-socket)
(open-channel
(lambda (p)
- (with-thread-timer-stopped
- (lambda ()
- (let ((channel ((ucode-primitive create-tcp-server-socket 0))))
- (system-pair-set-cdr! p channel)
- ((ucode-primitive bind-tcp-server-socket 3)
- channel
- (if (or (default-object? host) (not host))
- ((ucode-primitive host-address-any 0))
- host)
- (tcp-service->port service))
- ((ucode-primitive listen-tcp-server-socket 1) channel))
- #t)))))
+ (system-pair-set-cdr! p ((ucode-primitive create-tcp-server-socket 0)))
+ #t)))
+
+(define (bind-tcp-server-socket server-socket service host)
+ ((ucode-primitive bind-tcp-server-socket 3)
+ (channel-descriptor server-socket)
+ host
+ (tcp-service->port service)))
+
+(define (listen-tcp-server-socket server-socket)
+ ((ucode-primitive listen-tcp-server-socket 1)
+ (channel-descriptor server-socket)))
(define (tcp-service->port service)
(if (exact-nonnegative-integer? service)