Skip to content

Commit 599c24b

Browse files
committed
SocketHelpers: use NSAPI_IPv4 for dns resolution
1 parent 6175e39 commit 599c24b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: libraries/SocketWrapper/src/SocketHelpers.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ SocketAddress arduino::MbedSocketClass::socketAddressFromIpAddress(arduino::IPAd
132132
nsapi_error_t arduino::MbedSocketClass::gethostbyname(NetworkInterface* interface, const char* aHostname, SocketAddress* socketAddress) {
133133
char ifname[5] {};
134134
interface->get_interface_name(ifname);
135-
return interface->gethostbyname(aHostname, socketAddress, NSAPI_UNSPEC, ifname);
135+
nsapi_version_t version = NSAPI_IPv4;
136+
#if MBED_CONF_LWIP_IPV6_ENABLED
137+
version = NSAPI_UNSPEC;
138+
#endif
139+
return interface->gethostbyname(aHostname, socketAddress, version, ifname);
136140
}
137141

138142
// Download helper

0 commit comments

Comments
 (0)