Better representation of local address. Still limited by BSD sockets API.
This commit is contained in:
parent
3415e910f8
commit
3d0a635b62
|
@ -14,6 +14,6 @@
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(wait (message-handlers
|
(wait (message-handlers
|
||||||
[(udp-packet source (and sink (== s)) body)
|
[(udp-packet source (and sink (== s)) body)
|
||||||
(display "UDP!\n")
|
(write `(udp (source ,source) (sink ,sink))) (newline)
|
||||||
(send (udp-packet sink source body))
|
(send (udp-packet sink source body))
|
||||||
(loop)])))))
|
(loop)])))))
|
|
@ -12,8 +12,8 @@
|
||||||
udp-driver)
|
udp-driver)
|
||||||
|
|
||||||
;; A UdpAddress is one of
|
;; A UdpAddress is one of
|
||||||
;; -- a Symbol, representing a local socket
|
|
||||||
;; -- a (udp-address String Uint16), representing a remote 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)
|
(struct udp-address (host port) #:prefab)
|
||||||
|
|
||||||
;; A UdpPacket is a (udp-packet UdpAddress UdpAddress Bytes), and
|
;; A UdpPacket is a (udp-packet UdpAddress UdpAddress Bytes), and
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
(define s (udp-open-socket #f #f))
|
(define s (udp-open-socket #f #f))
|
||||||
(when port-number
|
(when port-number
|
||||||
(udp-bind! s #f 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-sender sname s))
|
||||||
(spawn (udp-receiver sname s buffer-size))
|
(spawn (udp-receiver sname s buffer-size))
|
||||||
(spawn (udp-closer sname s))
|
(spawn (udp-closer sname s))
|
||||||
|
|
Loading…
Reference in New Issue