|Subject:||Re: [Chicken-users] Help with udp6 / socket|
|Date:||Mon, 16 Feb 2015 21:17:14 -0600|
This works on my system (10.10.2, CHICKEN 22.214.171.124). Note the undocumented argument to udp-open-socket… not sure what I was thinking.
If this works for you, I will document the argument and add the example to the wiki.
(define s (udp-open-socket 'inet6))
(udp-bind! s "::" 1337) ;; unspecified address; accept both ipv4 and ipv6
(let loop ()
(receive (len str host port) (udp-recvfrom s 1024)
(print "received " len " bytes from [" host "]:" port " : " str))
;; Then we can run netcats using IPv4 and IPv6:
$ nc -6 -u localhost 1337
$ nc -4 -u localhost 1337
;; And you should get the following output:
received 6 bytes from [::1]:62028 : hello
received 3 bytes from [::ffff:127.0.0.1]:61031 : hi
|[Prev in Thread]||Current Thread||[Next in Thread]|