An interface to User Datagram Protocol sockets.
Category 5, with several enhancements by Daishi Kato
##net#recvfrom
)
udp-bound-port
[Contributed by Daishi Kato]
(require-extension udp)
[procedure] (udp-open-socket)
[procedure] (udp-open-socket*)
[procedure] (udp-bind! SOCKET HOST PORT)
[procedure] (udp-connect! SOCKET HOST PORT)
[procedure] (udp-send SOCKET STRING)
[procedure] (udp-sendto SOCKET HOST PORT STRING)
[procedure] (udp-recv SOCKET LENGTH)
LENGTH
. Returns two values:
the number n of bytes received and the string consisting the message.
[procedure] (udp-recvfrom SOCKET LENGTH)
[procedure] (udp-close-socket SOCKET)
[procedure] (udp-socket? THING)
[procedure] (udp-bound? SOCKET)
[procedure] (udp-connected? SOCKET)
[procedure] (udp-bound-port SOCKET)
[procedure] (udp-set-multicast-interface SOCKET ADDRESS)
[procedure] (udp-join-multicast-group SOCKET ADDRESS GROUP [JOIN])
csi> (require 'udp) ; loading /usr/local/lib/chicken/udp.so ... csi> (define s (udp-open-socket)) csi> (udp-bind! s #f 0) csi> (udp-connect! s "localhost" 13) ; daytime service csi> (udp-send s "\n") csi> (receive (n data from-host from-port) (udp-recvfrom s 64) (print* n " bytes from " from-host ":" from-port ": " data)) 26 bytes from 127.0.0.1:13: Wed Dec 24 11:53:14 2003 csi> (udp-close-socket s) csi>
Copyright (c) 2004, Category 5 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.