Better representation of local address. Still limited by BSD sockets API.

This commit is contained in:
Tony Garnock-Jones 2012-01-16 16:17:47 -05:00
parent 3415e910f8
commit 3d0a635b62
2 changed files with 3 additions and 3 deletions

View File

@ -14,6 +14,6 @@
(let loop ()
(wait (message-handlers
[(udp-packet source (and sink (== s)) body)
(display "UDP!\n")
(write `(udp (source ,source) (sink ,sink))) (newline)
(send (udp-packet sink source body))
(loop)])))))

View File

@ -12,8 +12,8 @@
udp-driver)
;; A UdpAddress is one of
;; -- a Symbol, representing a local socket
;; -- a (udp-address String Uint16), representing a remote socket
;; -- a (udp-address #f Uint16), representing a local socket
(struct udp-address (host port) #:prefab)
;; A UdpPacket is a (udp-packet UdpAddress UdpAddress Bytes), and
@ -30,7 +30,7 @@
(define s (udp-open-socket #f #f))
(when port-number
(udp-bind! s #f port-number))
(define sname (gensym 'udp-socket)) ;; !!! %%% TODO ?
(define sname (udp-address #f port-number))
(spawn (udp-sender sname s))
(spawn (udp-receiver sname s buffer-size))
(spawn (udp-closer sname s))