Page 1 of 1

Reverse DNS lookup

PostPosted: Tue Oct 24, 2017 5:16 pm
by steve1376656734
Hi,

Can anyone suggest the best way to do a reverse DNS lookup from within Servoy? I want to get the hostname for my client connection but all the plugins (UserManager, IT2BE_tools, clientmanager) do not give the correct hostname (as well as only varying success with the client IP address!).

I have looked at (what I think) are all the obvious places for a function call that will give me this capability but nothing jumps out as being correct.

Thanks
Steve

Re: Reverse DNS lookup

PostPosted: Fri Oct 27, 2017 8:35 am
by rgansevles
Hi Steve,

You could write a java plugin for it, or use the httpclient plugin to resolve the hostname of an ip using a web service.

Why do you need to know the hostname of the client?

Rob

Re: Reverse DNS lookup

PostPosted: Mon Oct 30, 2017 5:35 pm
by steve1376656734
I need to know if a particular client session is coming from a specific place. The source does not have a fixed IP address and updates a dynamic DNS service whenever the IP changes so I need to do a nslookup of the dynamic DNS name to see if the IP address of the client session matches.

Is there any reason you can think of that I cannot use the following rather than write a plugin or a web service):

var inetAddr = Packages.java.net.InetAddress.getByName("myDyns.noip.com");

Thanks

Re: Reverse DNS lookup

PostPosted: Mon Oct 30, 2017 10:04 pm
by rgansevles
Steve,

You can use java packages directly from js.
But your example is not reverse lookup.

Rob

Re: Reverse DNS lookup

PostPosted: Mon Oct 30, 2017 10:52 pm
by steve1376656734
:D Bad example on my part - should have put:
Code: Select all
var inetAddr = Packages.java.net.InetAddress.getByName("123.123.123.123");


But thanks for confirming that I can call the java package directly - this is sooooo much simpler than a web service or plugin. Are there any circumstances where you should not use the underlying Java directly?

Re: Reverse DNS lookup

PostPosted: Tue Oct 31, 2017 10:33 am
by Harjo