udp connections have no state

This commit is contained in:
Doug MacEachern 2005-03-11 17:18:57 +00:00
parent 91b3efc822
commit 4f7a9ccb80
1 changed files with 10 additions and 1 deletions

View File

@ -125,6 +125,15 @@ public class Netstat extends SigarCommandBase {
for (int i=0; i<connections.length; i++) { for (int i=0; i<connections.length; i++) {
NetConnection conn = connections[i]; NetConnection conn = connections[i];
String proto = conn.getTypeString(); String proto = conn.getTypeString();
String state;
if (conn.getType() == NetFlags.CONN_UDP) {
state = "";
}
else {
state = conn.getStateString();
}
println(proto + println(proto +
"\t" + "\t" +
formatAddress(conn.getLocalAddress()) + ":" + formatAddress(conn.getLocalAddress()) + ":" +
@ -132,7 +141,7 @@ public class Netstat extends SigarCommandBase {
"\t" + "\t" +
formatAddress(conn.getRemoteAddress()) + ":" + formatAddress(conn.getRemoteAddress()) + ":" +
formatPort(proto, conn.getRemotePort()) + "\t" + formatPort(proto, conn.getRemotePort()) + "\t" +
conn.getStateString()); state);
} }
} }