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.
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
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.
Well...you can call netstat from IRIS...for example:
set status = $ZF(-100, "/LOGCMD", "netstat", "-ano", "-p", "tcp")
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.
The 0 means that has been executed succesfully. Are you executing from any class or from terminal? Maybe you need to redirect the output into a file:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
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 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