jsmnsr
Contributor
Contributor

getProcPort --- SigarFileNotFoundException

System: Windows XP

I am writing an application that links incoming packets to the associated process listening on that port. I gather all of the current net connections, and iterate through each one and call "getProcPort" with the appropriate parameters.

This seems to work for about roughly 50% of the connections. The rest of the calls to getProcPort result in the following exception:

org.hyperic.sigar.SigarFileNotFoundException: The system cannot find the file specified.

at org.hyperic.sigar.Sigar.getProcPort(Native Method)
...


Any ideas about what "file" this is referring to?

Thank you
0 Kudos
2 Replies
dougm_hyperic
VMware Employee
VMware Employee

The sigar_proc_port_get function returns ENOENT if it can't find the listen port in the tcp connection table. The string version of that error code is "The system cannot find the file specified."

Do you see the pid/process-name in the last column for each listener with this command ?
java -jar sigar-bin\lib\sigar.jar netstat -lntp
0 Kudos
gheale
Contributor
Contributor

I seem to be getting a very similar problem on MacOs.  I keep getting the error - "No such file or directory" when I use getProcPort and never get the process number.

I tried running the netstat command and do not get the following (abridged):

Proto    Local Address      Foreign Address    State    

tcp      127.0.0.1:1338     *:*                LISTEN   

tcp      127.0.0.1:1337     *:*                LISTEN   

tcp      *:3717             *:*                LISTEN 

No process numbers or names.

Is there any other approach I can take?

0 Kudos