PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

How to get PC's IP address?

View previous topic View next topic Go down

How to get PC's IP address?

Post  maran on Fri Dec 30, 2011 1:00 pm

Use the API QDCRDEVD (Retrieve Device Description) API to retrieve a PC's IP address.

H DFTACTGRP(*NO) BNDDIR('QC2LE')
D RtvIpAdr PR 20a
D Device 10a CONST
*
D I_Net_Adr S 16a
*
D SDS
D Device 244 253
*---------------------------------------------------------
* Retrieve IP Address
C Eval I_Net_Adr = RtvIpAdr(Device)
C Eval I_Net_Adr = %trim(I_Net_Adr)

C I_Net_Adr Dsply
C Eval *Inlr = *On
*---------------------------------------------------------
* RtvIpAdr - Subprocedure To Retrieve PC's IP Address
*---------------------------------------------------------
P RtvIpAdr B Export
D RtvIpAdr PI 20A
D Inp_Device 10A Const
D Apierr DS
D Bytprv 1 4B 0 Inz(216)
D Bytavl 5 8B 0 Inz
D Errid 9 15A Inz
D Rsvd 16 16A Inz
D Errdta 17 216A Inz
D Net_Address S 20A INZ
D Format S 8A Inz('DEVD0600')
D Rcvar S 5000A Inz
D Varlen S 4B 0 Inz(5000)
C Eval Device = Inp_Device
C Call 'QDCRDEVD'
C Parm Rcvar
C Parm Varlen
C Parm Format
C Parm Device
C Parm Apierr
C If BytAvl = 0
C Eval Net_Address = %Subst(Rcvar:877:16)
C Endif
C Return Net_Address
P RtvIpAdr E

maran
Admin

Posts : 442
Join date : 2009-07-24

View user profile http://pmsinformationsystem.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum