IPv6 fallback to IPv4

I recently had an issue where my IPv6 connection was not working (ping google.com resolved to an IPv6 address and failed to get a response), but IPv4 was working (ping -4 google.com got responses). I was able to use Firefox without noticing any issues, but my racket programs had failed with timeout errors. Is there perhaps a way to either force racket to use IPv4 or try to set a fallback mechanism to use IPv4 in case of IPv6 connection failures? So far, this situation seems very rare for my internet connectivity.