Ethernet.h: no close() for DNSclient?

I am wondering why there is no close() function for a DNSclient in the Ethernet library? The initialization and usage documented everywhere like

#include <Ethernet.h>
...
DNSclient D;
...

setup()
{
...
D.begin(Ethernet.dnsServerIP()); 
...
D.getHostByName("foo.bar.com", &IPs);
...

never has something like D.close(); in it.

Would not that block a socket forever? The DNS request is a UDP packet IIRC, so ther must be some socket involved.

EthernetUdp doesn't have a close() method. As no connection is opened it doesn't have to be closed. UDP is connectionless, it just sends/receives single packets.

pylon:
EthernetUdp doesn't have a close() method. As no connection is opened it doesn't have to be closed. UDP is connectionless, it just sends/receives single packets.

but to receive a replay a UDP listener must be started.
the getHostByName function starts and stops it.
begin() only stores the server's address.

Miq1, it is open source. you can look into the source code to see how it works.

Juraj:
but to receive a replay a UDP listener must be started.
the getHostByName function starts and stops it.
begin() only stores the server's address.

Thank you, Juraj! That was the answer I was looking for. :slight_smile: