How can I determine the IP address from which data is come from a TCP Inbound Adapter?

Primary tabs

Ensemble

We want to be able to dispatch based on the IP address who connected to a TCP Inbound adapter.  

The address is in ..Adapter.%outIPAddr when the connection is made and reported with $$$LOGINFIO() but by the time OnProcessInput() is called the value is blank.  

Replies

Hi Kevin,

You can use IOAddr property from EnsLib.TCP.CountedInboundAdapter

IOAddr property come in this format : 57777<-127.0.0.1:54844

To extract the source IP adresse you can parse it like that :

set fullIOAddr = ..Adapter.IOAddr //57777<-127.0.0.1:54844
 
set remoteIP = $P($P(fullIOAddr,"-",2),":",1) //127.0.0.1