\r
 begin\r
   //init both sockets smultaneously, always, so they get succesive fd's\r
-  if fd[0] > 0 then exit;\r
+\r
+  {recreate sockets every time, reusing them will fail (hang) if the nameserver is changed\r
+  also changing the nameserver can't possibly work}\r
+  {if fd[0] > 0 then exit;}\r
+  for a := 0 to numsock-1 do if (fd[a] > 0) then closesocket(fd[a]);\r
 \r
   biniptemp := getcurrentsystemnameserverbin(id);\r
   //must get the DNS server here so we know to init v4 or v6\r