Question Norman W. Freeman · Jul 27, 2023

Is it possible to get a list all active open TCP/IP connections made by IRIS ?

There is several classes that allow to create TCP/IP connections (eg: to connect to a service).

Example : %Net.FtpSession (port 21), %Net.HttpRequest (usually port 80 or 443)

AFAIK connection will stay open unless closed explicitly or if variable that hold the instance is garbage collected.

Is there a way to get a list of all active (open) TCP/IP connections IRIS is maintaining so far ?

I took a look at Portal (eg: in dashboard, "System Resource Statistics") but couldn't find anything. Web Gateway panel provide information about connections but this is incoming connections for CSP pages. I am look for external connections (the other way around).

If it's not available in Portal, some API / classes will be fine too.

I could of course run TCPView , netstat or something like that but I am looking for something built-in in IRIS.

Product version: IRIS 2021.1
$ZV: IRIS for Windows (x86-64) 2021.1 (Build 215U) Wed Jun 9 2021 09:39:22 EDT

Comments

Deepak Ghansala · Jul 27, 2023

Hi Norman,

Its available through the portal, System Operation ->Processes, then you check the Device column.

In the device column, you would have something like this:-

|TCP|33010|472

Here, 33010 is the TCP port and 472 is the job number.

Regards,

Deepak Ghansala

0
Norman W. Freeman  Jul 27, 2023 to Deepak Ghansala

Hi. AFAIK this only show the current active output device (eg: the last one set by USE command). There can be many underlaying connections under that process.

0
Luis Angel Pérez Ramos · Jul 27, 2023

Well...you can call netstat from IRIS...for example:

set status = $ZF(-100, "/LOGCMD", "netstat", "-ano", "-p", "tcp")
0
Norman W. Freeman  Jul 27, 2023 to Luis Angel Pérez Ramos

I have tried that that command but all I got in message.log is this : 

[Generic.Event] $ZF(-100) cmd=netstat -ano -p tcp
[Generic.Event] $ZF(-100) ret=0

Is there something special to enable (like some flags that prevent full dump) ?
The documentation does not say much about it.

0
Norman W. Freeman · Aug 6, 2023

Here is the solution I end up using. This is based on a solution suggested by Julius Kavay :

set cmd="netstat -anp TCP"set oldIO = $ioopen cmd:"QR":10use cmd
// in case, $zeof is not set per default// set old=$system.Process.SetZEOF(1)  for {
  read line  //timeout alternative, no need of $zeof: read line:1 quit:$zeof
  ... //do something with line
}
close cmd
use:oldIO]"" oldIO
// d $system.Process.SetZEOF(old)

You can find more info about it here.

As an alternative, it's also possible to use pipes ($zeof must be used as well): 

set dev="|CPIPE|"_$job   
open dev:cmd:10   
use dev
...

close dev
0