Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 10:24 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Hostname support
PostPosted: Thu Feb 16, 2012 7:42 am 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Is there any mechanism to support the use of hostnames instead of IP addresses when doing UDP/TCP transmissions? I have a destination computer which has a changing DHCP address and it would be much easier to just enter a hostname. I'm guessing not since there is no facility to enter a DNS address.

Thanks


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 7:45 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Yes and no.

There is no automatic support for hostname lookup. You can use the DNSClientV2 object to perform a manual lookup, then set the IPAddress property of another object with the results of that lookup. We do that all the time around here on our Qlarity terminals.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 8:37 am 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Natenstein wrote:
Is there any mechanism to support the use of hostnames instead of IP addresses when doing UDP/TCP transmissions? I have a destination computer which has a changing DHCP address and it would be much easier to just enter a hostname. I'm guessing not since there is no facility to enter a DNS address.

Thanks


Could you give me some more details on how to do this?
Thanks


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 8:43 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
It is pretty easy. Create a DNSClientV2 object in your workspace. Set the DNSIPAddress to be the IP address of your DNS server.

Next, call RequestIPAddress on the host name you wish to resolve. (e.g. DNSClient_1.RequestIPAddress("google.com"))

Next, handle the IPAddressReceived event of the DNSClientV2 object and then do something useful with it.
Code:
func IPAddressReceived(IPAddress as string, IPAddr[] as byte)
    MyHypotheticalEthernetObject.IPAddress = IPAddress
    MyHypotheticalEthernetObject.Connect()
endfunc


You might also want to handle the two error events to deal with a DNS failure case.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 9:10 am 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Jeremy wrote:
It is pretty easy. Create a DNSClientV2 object in your workspace. Set the DNSIPAddress to be the IP address of your DNS server.

Next, call RequestIPAddress on the host name you wish to resolve. (e.g. DNSClient_1.RequestIPAddress("google.com"))

Next, handle the IPAddressReceived event of the DNSClientV2 object and then do something useful with it.
Code:
func IPAddressReceived(IPAddress as string, IPAddr[] as byte)
    MyHypotheticalEthernetObject.IPAddress = IPAddress
    MyHypotheticalEthernetObject.Connect()
endfunc


You might also want to handle the two error events to deal with a DNS failure case.



Perfect. Thank you.


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 10:36 am 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Jeremy wrote:
It is pretty easy. Create a DNSClientV2 object in your workspace. Set the DNSIPAddress to be the IP address of your DNS server.

Next, call RequestIPAddress on the host name you wish to resolve. (e.g. DNSClient_1.RequestIPAddress("google.com"))

Next, handle the IPAddressReceived event of the DNSClientV2 object and then do something useful with it.
Code:
func IPAddressReceived(IPAddress as string, IPAddr[] as byte)
    MyHypotheticalEthernetObject.IPAddress = IPAddress
    MyHypotheticalEthernetObject.Connect()
endfunc


You might also want to handle the two error events to deal with a DNS failure case.



Does this method also support local hostnames (i.e. "computer1.local")?


Top
 Profile  
 
 Post subject: Re: Hostname support
PostPosted: Thu Feb 16, 2012 10:40 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
That will depend entirely on what your DNS server is willing to do. Here it seems to work, as long as I provided a fully qualified name.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group