Jump to content

DNS Resolver Example program

Recommended Posts

  • MVP 2023

We recently did a tank status project where the customer wanted to type in the name of his mail server for the email block.  Working through the DNS Resolver function block revealed a couple of errors in the Help (this is very rare - I'm guessing not too many people have used this block).


Unitronics has been notified of the Help errors and they will be corrected in the next release.  In the meantime, the biggest problem is the protocol must be UDP_RAW, not UDP.  The other issue is the Help shows sequential addresses in the IP configuration blocks, which anyone who's worked with these blocks knows they must be separated by at least four addresses to leave room for the whole IP address.


I have attached an example program for anyone who wants to look at it.


Joe T.

DNS Resolver Test.vlp

Link to comment
Share on other sites


have not find anything wrong in your test, I have similar code and it works without any problems.

Only 2 advises:

1. try to avoid binding UDP sockets to ports 20000-20255

2. initiate socket every time prior to calling DNS server and bind it to different port. By using same source port  you may hit "Unidirectional Link Detection"  implemented in the most of switches

Link to comment
Share on other sites

  • 3 months later...

Hello everyone !!

   Usually read everything that appears in the forum and this afternoon was over 3 hours trying to use the "dns resolver function" and could not reply from the DNS server. The solution was this forum topic. It was enough to make the change of protocol "udp" to "udp raw" and it worked perfectly. Many thanks Joe Tauser. Now I will try the solution from "linxchas", because I used one of the specified ports.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...