· Jul 27

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
Discussion (6)2
Log in or sign up to continue

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 = $io
open cmd:"QR":10
use 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 
  ... //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