stevecondylios / netstat

Network statistics in R
https://stevecondylios.github.io/netstat/
Other
3 stars 4 forks source link

Bug in `ports_in_use` on Windows #9

Open MarkMc1089 opened 1 year ago

MarkMc1089 commented 1 year ago

There is a small bug in the code for ports_in_use, on Windows machines at least: https://github.com/stevecondylios/netstat/blob/master/R/ports_in_use.R#L30

local <- active_connections_table[, 4] # The 4th column is taken to use in getting the active ports

It should be the 3rd column, as can be seen from

names(parse_netstat(netstat())) [1] "X" "Proto" "Local" "Address" "Foreign" "Address.1" "State"

I am not sure of 2 things. First, if this could be locale dependent. Second, whether this would affect non-Windows machines. I will put in a PR for the Windows side tho.