windows service file is not in /etc/services

This commit is contained in:
Doug MacEachern 2005-03-11 04:14:27 +00:00
parent ca1e9686d9
commit c66f80fa06
1 changed files with 12 additions and 1 deletions

View File

@ -14,11 +14,22 @@ import java.util.StringTokenizer;
public class NetPortMap { public class NetPortMap {
private static final String SERVICE_FILE;
private static Map udpServices = null; private static Map udpServices = null;
private static Map tcpServices = null; private static Map tcpServices = null;
static {
if (SigarLoader.IS_WIN32) {
SERVICE_FILE = "C:\\windows\\system32\\drivers\\etc\\services";
}
else {
SERVICE_FILE = "/etc/services";
}
}
private static void parseServices(String type, Map services) { private static void parseServices(String type, Map services) {
File file = new File("/etc/services"); File file = new File(SERVICE_FILE);
if (!file.exists()) { if (!file.exists()) {
return; return;
} }