How to get PC's IP address?

Go down

How to get PC's IP address?

Post  Archana K on Sun Jan 27, 2013 5:28 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



Archana K

Posts : 76
Join date : 2013-01-27
Age : 27
Location : chennai

View user profile

Back to top Go down

Back to top


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