fix udp test and update docs related to socket re-binding

svn: r10835
This commit is contained in:
Matthew Flatt 2008-07-18 21:33:11 +00:00
parent 7c6b93f531
commit 69d604c0be
2 changed files with 17 additions and 4 deletions

View File

@ -304,9 +304,14 @@ and port. If a socket is not bound before it is used with a sending
procedure @scheme[udp-send], @scheme[udp-send-to], etc., the sending
procedure binds the socket to a random local port. Similarly, if an
event from @scheme[udp-send-evt] or @scheme[udp-send-to-evt] is chosen
for a synchronization (see @secref["sync"]), the socket is bound;
if the event is not chosen, the socket may or may not become
bound. The binding of a bound socket cannot be changed.
for a synchronization (see @secref["sync"]), the socket is bound; if
the event is not chosen, the socket may or may not become bound.
The binding of a bound socket cannot be changed, with one exception:
on some systems, if the socket is bound automatically when sending, if
the socket is disconnected via @scheme[udp-connect!], and if the
socket is later used again in a send, then the later send may change
the socket's automatic binding.
If @scheme[udp-socket] is already bound or closed, the
@exnraise[exn:fail:network].}

View File

@ -100,7 +100,15 @@
(sleep 0.05)
(test udp2-r sync udp2-r)
(test udp2-r sync udp2-r)
(test (list 10 "127.0.0.1" udp1-port) sync (udp-receive!-evt udp2 us1))
(test (list 10 "127.0.0.1")
;; Above disconnect may change udp1's auto-assigned port,
;; so don't check the port number:
(lambda (l)
(if (and (list? l)
(= 3 (length l)))
(list (car l) (cadr l))
l))
(sync (udp-receive!-evt udp2 us1)))
(test #f sync/timeout 0.05 udp2-r)
(test #f sync/timeout 0.05 (udp-receive!-evt udp2 us1))