Closed biaxident closed 5 years ago
I read RFC 6555 and understood what the problem is.
If java.net.Socket.connect(SocketAddress endpoint, int timeout)
can be retried even after it throws an exception without re-creation of the Socket
instance, it may be relatively easy to implement the code which tries all the addresses returned by getAllByName()
.
@biaxident Could you investigate whether Socket.connect()
can be called twice or more on the same Socket
instance until connect()
succeeds?
Thank you for fast reply.
I've checked the behavior of calling Socket.connect()
on already exceptioned socket.
Unfortunately, in this case the second connect completes with exception java.net.ConnectException: failed to connect to ...: connect failed: EBADF (Bad file descriptor)
.
@TakahikoKawasaki Is it possible to recreate socket after exception is thrown?
@biaxident Thank you for the investigation. I'll try to devise a mechanism for the issue described in RFC 6555. How urgent is this issue for you?
It's pretty urgent. I think we will fork the repo and do it as soon as possible.
@TakahikoKawasaki Hi. Issue is listed as open. Any plans to fix it?
Also ran into this. People happen to have IPv6 enabled in their routers without having "real" IPv6 WAN connectivity. We may experience this more often, since more users & companies are starting their IPv6 journey.
//edit: seems like @biaxident already implemented a solution in his fork: https://github.com/biaxident/nv-websocket-client/commit/1676e7f2ed225a479d0be03fd75e9d48a565bfa3
I'm also affected by this. If a domain has both A and AAAA records, and if a device has a local IPv6 address but no proper routes set up, then connecting fails.
@biaxident could you maybe create a pull request against this repo with your implementation, so that the change can get upstreamed? (I'm not sure about the proxy change, I don't need proxy support but as far as I understand this has simply been removed.)
Hi! Thank you for the great library again! We have major issue with nv-websocket-client that it has not correct ipv4 fallback when target host not reachable by ipv6. I'm talking about https://tools.ietf.org/html/rfc6555 and so called dual-stack hosts. WebSocketFactory uses straightforward InetSocketAddress obtained by InetAddress.getByName() function instead of InetAddress.getAllByName() to handle all existing InetAdresses. Is there are plans to add rfc6555 support to nv-websocket-client or is it possible to customize your library somehow to write it ourselves? This issue is very critical for us, because we have a lot of complaints from our users about this.