Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6 #29

Open
ton4eg opened this issue Apr 5, 2016 · 2 comments
Open

ipv6 #29

ton4eg opened this issue Apr 5, 2016 · 2 comments

Comments

@ton4eg
Copy link

ton4eg commented Apr 5, 2016

Is it possible to use async for ipv6?

I tried something like this:

async = require 'async'
async.tcp.listen({host='::', port=8088}, function(client)
      client.ondata(function(chunk)
            print('received: ' .. chunk)
            client.write('thanks!')
      end)
      client.onend(function()
            print('client gone...')
      end)
end)

async.go()

strace show that bind(10, {sa_family=AF_INET, sin_port=htons(8088), sin_addr=inet_addr("255.255.255.255")}, 16) = 0

And 255.255.255.255 seems wrong...

I tried luv:

   local server = uv.new_tcp()
   uv.tcp_bind(server, host, port)
   server:listen(128, function(err)
                    assert(not err, err)
                    local client = uv.new_tcp()
                    server:accept(client)

                    on_connection(client)
   end)

And it supports ipv6.

But if I reinstall async this luv example stop work with:
attempt to call method 'listen' (a nil value)
stack traceback:
test_luv.lua:8: in function 'create_server'
test_luv.lua:22: in main chunk
[C]: in function 'dofile'
...arev/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00406680

@soumith
Copy link
Contributor

soumith commented Apr 6, 2016

async does seem to have ipv6 issues. i didn't spend time tracking them down, but i ran into similar issues.
One solution is to bind to 0.0.0.0 which works even with ipv6 (but binds to alll interfaces which might be insecure depending on what you want to do)

@ton4eg
Copy link
Author

ton4eg commented Apr 8, 2016

Tried 0.0.0.0 but still don't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants