Finding an IP address in a Task trace

Document ID : KB000029783
Last Modified Date : 14/02/2018
Show Technical Document Details

When a Server-based task requests services from an IDMS CV, the IP address is stored in our control blocks. In debugging a task that fails, it may be helpful to identify the IP address from which that task originated, The short answer is, the IP address is at PTELSOC4+4 for v18.5 (PTE+174 in 18.0). Here is the long explanation: 

The PTE* fields belong to a LISTENER type PTE. When a new task is started by generic listening, it runs under control of a BULK PTE/LTE pair. The following fields from a BULK pte can be examined: 

1- PTELSALN contains the length of the SOCKADDR structure filled in with info from the client 

 

2- PTELSOC4 and PTELSOC6 fields point to the same area, and contain the SOCKADDR structure filled in with info from the client. An IPv4 type SOCKADDR structure is described by the SOCK@IN dsect; the IPv6 type structure is described by the SOCK@IN6 dsect; both dsects are generated by a #SOCKET TCPIPDEF assembler call. For an IPv4 type SOCKADDR structure, the IPaddress is saved at offset 4. 

 

The IP address is stored in the control blocks as a fullword; each byte of the fullword represents a value that would normally be separated by a period. 

For example: 
- a hex value of F7000001 would translate to an IP address of 127.0.0.1 
- and a hex value of AC10FE01 would translate to 172.16.254.1.