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.
3条答案
按热度按时间r6vfmomb1#
On shell A:
to test, on shell B:
hmmo2u0o2#
根据
gen_tcp
模块的手册页,connect/3-4
的第一个参数应该是inet:socket_address()
或inet:hostname()
类型。尝试使用This形式的类型。
s4n0splo3#
除了(0,0,0,0,0,0,0,0,1}。我们也可以使用您自己的IPv6地址。请使用inet:parse_address(“您的IP地址”)。