|Subject:||Re: [Chicken-users] Help with udp6 / socket|
|Date:||Tue, 17 Feb 2015 10:56:40 +0100|
Scott,This works on my system (10.10.2, CHICKEN 184.108.40.206). 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.(use udp6)(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))(loop))(udp-close-socket s);; Then we can run netcats using IPv4 and IPv6:$ nc -6 -u localhost 1337hello^C$ nc -4 -u localhost 1337hi^C;; And you should get the following output:received 6 bytes from [::1]:62028 : helloreceived 3 bytes from [::ffff:127.0.0.1]:61031 : hiOn Feb 16, 2015, at 07:06, Scott McCoid <address@hidden> wrote:Hi Christian!Thanks for the quick help and netcat tip. I was able to send from my script and receive with netcat (for example: nc -u -6 -l 8000) without any problems. (sending to port 8000 in my script)I've tried doing the reverse situation, where I receive on the script side and send using netcat, but I haven't been able to get this to work. I don't have any errors, but I'm not receiving anything for some reason.I'll work on some chicken scripts that talk to each other and see if I can get this to work properly.Thanks again for your help!Scott_______________________________________________On Mon, Feb 16, 2015 at 11:49 AM, Christian Kellermann <address@hidden> wrote:Hi Scott!
Scott McCnoid <address@hidden> writes:
> I'm reasonably new to chicken-scheme (and scheme in general), and I'm
> having trouble with the udp6 (and likewise, socket) eggs. I'm trying to run
> the example code, but the connection is always refused.
> *Error: (socket-receive!) cannot read from socket - Connection refused:
> #<socket fd:4 af/inet sock/dgram>*
> I looked into the socket code and it seems that this is probably not the
> fault of these eggs per se, but probably something I'm doing wrong. For
> example, the *%socket-receive!* function makes a call to the <sys/socket.h>
> *recv* function, which always returns -1. I've tried using other port
> numbers to connect to, but this doesn't seem to make a difference.
> I'm on Mac OS *10.10.2* using chicken scheme v.* 220.127.116.11 *(stability/4.9.0)
> (rev 8b3189b)
> I'm happy to help track this down if it's a bug, just let me know.
The most likely reason is that on Mac OS X there is noone listening on
You can check that manually with "nc localhost 13".
The next problem is that noone is actually listening on ipv6 for that
port. I ran into this when trying to simulate the datetime service with:
"date | sudo nc -u -l -p 13"
Connecting with v4 works, with v6 it doesn't.
My suggestion is to test this with a known open service on your system
or by creating a server explicitly bound to a v6 address.
Please don't hesitate to report further issues and troubles!
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.
Chicken-users mailing list
Chicken-users mailing list
|[Prev in Thread]||Current Thread||[Next in Thread]|