0

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.

user3404572
  • 167
  • 8

3 Answers3

1

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
David Buck
  • 3,752
  • 35
  • 31
  • 35
0

According to the manual page of gen_tcp module, First argument of connect/3-4 should be type of inet:socket_address() or inet:hostname().
Try using This form of type.

Pouriya
  • 1,626
  • 11
  • 19
0

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").