Skip to content

ipv6 #29

@ton4eg

Description

@ton4eg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions