# IPv6 fallback to IPv4

**URL:** <https://racket.discourse.group/t/ipv6-fallback-to-ipv4/1039>\
**Category:** General\
**Created:** [May 28, 2022, 12:23am UTC](https://racket.discourse.group/t/ipv6-fallback-to-ipv4/1039 "2022-05-28T00:23:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mflatt](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/mflatt/32/6_2.png) [@mflatt](https://racket.discourse.group/u/mflatt)\
**Post date:** [July 2, 2024, 10:53pm UTC](https://racket.discourse.group/t/ipv6-fallback-to-ipv4/1039/4 "2024-07-02T22:53:19Z")

</div>

I think the only relevant documentation is `tcp-connect`: "(If hostname is associated with multiple addresses, they are tried one at a time until a connection succeeds....)".

Racket uses the `getaddrinfo` library from the OS, and it tries the resulting addresses in order, which might mean trying an IPv6 address before IPv4. Depending on the failure mode, that sequence it might get stuck trying IPv6 so that it never gets around to trying an IPv4 address.

Racket's use of `getaddrinfo` includes a non-NULL `hints`, but its hints flags do not include `AI_ADDRCONFIG | AI_V4MAPPED`, which is apparently the default these days (as opposed to 0). It seems possible that adding those flags would improve things and maybe address the problem, but I welcome advice from anyone who knows more about this.

---

_[View the full topic](https://racket.discourse.group/t/ipv6-fallback-to-ipv4/1039)._
