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

Joe,

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.