[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Translation IP host name to IP address?

» close window

The Question is:

 
I'm porting some UNIX code to VMS and came across this problem. I'm getting the
 user's IP address to identify the user machine. In VMS, I was able to get the
 IP address of the user, at the prompt with the following code.
 
$ ERR = F$GETDVI("TT","TT_ACCPORNAM")
$ SHOW SYMBOL ERR
 
I suppose, I can use SYS$GETDVI in my program to achieve the same.
But, the real problem is when a user telnet into the VMS server. When I use the
 above code, all I get is the name of the server and not the IP address. I
 would like to get the IP address of the server, where the user is telneting,
 instead of it's name.
Or else, if I get the name, how can I get the IP address from the server name ?
 
How can I achieve this ? Is there any sample code available ?
 
Thanks in advance
 


The Answer is :

 
  You can use the available (and standard) socket calls to translate an IP
  host name into an host IP address using DNS -- please see the appendix of
  the TCP/IP Services programming documentation and see the socket appendix
  of the Compaq C run-time library reference documentation for the APIs.
 
  Also note that TCP/IP Services V5.1 has better support in this area than
  does V5.0.
 
  Also note that telnet clients do not use any particular port as the
  source for the IP connection -- the source port for an incoming telnet
  connection can (and does) vary.  The target (default) port for a telnet
  connection arriving at a telnet server is (of course) fairly standard.
 

answer written or last revised on ( 6-SEP-2001 )

» close window