Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
2 ratings:
 4.5 out of 5   

Convert a Hostname to an IP Address in LabVIEW



Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Base Development System, LabVIEW Development Systems>>LabVIEW Professional Development System

Problem:
Is it possible to programmatically convert a hostname to an IP address in LabVIEW, and if so, how do I do it?

Solution:
A hostname can easily be converted to an IP address in LabVIEW by using two String to IP VIs in series.
  1. Navigate to Data Communication»Protocols»TCP in the functions palette and place a String to IP VI onto the block diagram.
  2. Right-click the name input of the String to IP VI and select Create»Control
  3. Navigate to Data Communication»Protocols»TCP in the functions palette and place an IP to String VI onto the block diagram.
  4. Connect the net address output of the String to IP VI to the net address input of the IP to String VI.
  5. Right-click the dot notation? input of the IP to String VI and select Create»Constant. Make sure the created Boolean constant is set to True.
  6. Right-click the name output of the IP to String VI and select Create»Indicator.

The resulting output on the IP to String VI is a string containing the IP address of the original hostname. The finished code is illustrated below:



Related Links:
KnowledgeBase 3B6BTU4B: Return IP Address Instead of Machine Name in TCP Listen.vi and/or TCP Wait on Listener.vi
KnowledgeBase 4A7G1N97: Programmatically Obtain a Computer's IP Address Using LabVIEW or LabWindows/CVI


Attachments:
Hostname to IP.vi

Hostname2IP.bmp


Report Date: 10/24/2004
Last Updated: 09/05/2017
Document ID: 3ENE8DL2

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit