From: Jim Becker [jbecker@ui.urban.org] Sent: Thursday, October 11, 2001 11:17 PM To: Info-VAX@Mvb.Saic.Com Subject: Re: How to obtain IP address Nazim MANSER wrote: [snip] > But the IP Address field is truncated, so how to obtain the whole IP address ? > How to interpret the following fields > > Remote node addr. 31541 > Remote ID: TELNET_BC000424 I offer REMID2IP.COM, which I normally call from other DCL procedures. Examples: $ @remid2ip TELNET_BC000424 $ show symbol ip_address IP_ADDRESS == "188.0.4.36" $ @remid2ip FTP_BC000424 $ show symbol ip_address IP_ADDRESS == "188.0.4.36" $ @remid2ip BC000424 $ show symbol ip_address IP_ADDRESS == "188.0.4.36" $ @remid2ip !By default, value of SYS$REM_ID used, if available $ show symbol ip_address IP_ADDRESS == "66.44.7.64" [beginning of REMID2IP.COM] $! Convert a hex-string version of an IP address to a dotted decimal $! string in the global DCL symbol IP_ADDRESS. $! Jim Becker $ if p1 .eqs. "" $ then $ rem_id = f$trnlnm ("sys$rem_id") $ else $ rem_id = p1 $ endif $ if rem_id .eqs. "" then exit $! $! Remote id often appears in these forms: TELNET_xxxxxxxx, FTP_xxxxxxxx $ if f$locate ("_", rem_id) .lt. f$length (rem_id) $ then hex_address = f$element (1, "_", rem_id) $ else hex_address = rem_id $ endif $! $ msg = f$environment ("message") $ on warning then goto skip_ip $ set message /nofacility /noseverity /noident /notext $ byte1 = %x'f$extract (0, 2, hex_address)' $ byte2 = %x'f$extract (2, 2, hex_address)' $ byte3 = %x'f$extract (4, 2, hex_address)' $ byte4 = %x'f$extract (6, 2, hex_address)' $ ip_address == f$fao ("!UB.!UB.!UB.!UB", byte1, byte2, byte3, byte4) $ skip_ip: $ set message 'msg' [end of REMID2IP.COM] -- Jim Becker The Urban Institute (http://www.urban.org/) Encompass (http://www.encompassus.org/) ESILUG (http://encompasserve.org/lugs/esilug/)