Reputation: 167
Does anyone know how to connect to ipv6 tcp server address. Following tried but does not work.
{ok, Socket} = gen_tcp:connect("2a01:488:67:1000:253d:cd31:0:1", 5000, [{active, false},inet6]).
{error,enetunreach}
And this
{ok, Socket} = gen_tcp:connect("[2a01:488:67:1000:253d:cd31:0:1]", 5000, [{active, false},inet6]).
{error,nxdomain}
The server is reachable over IPv4 though.
Thanks.
Upvotes: 0
Views: 711
Reputation: 11
Instead of (0,0,0,0,0,0,0,1}.We can also use your own IPv6 address. Use inet:parse_address("your IP address").
Upvotes: 0
Reputation: 11
On shell A:
$erl
{ok, LSocket} = gen_tcp:listen(12345, [binary, {packet, line}, {active, true}, {reuseaddr, true}, inet6, {ip, {0,0,0,0,0,0,0,1}}]).
to test, on shell B:
$telnet ::1 12345
Upvotes: 1