public final class GetServiceByName
extends java.lang.Object
GetServiceByName
class provides lookup of port numbers from the /etc/services
file.
For example, given a line in /etc/services http 80/tcp
A search for service "http" and type "tcp" returns 80
Modifier and Type | Method and Description |
---|---|
static int |
getPort(java.lang.String serviceName)
Convenience Method to get a tcp service method.
|
static int |
getPort(java.lang.String serviceName,
java.lang.String type)
Get the integer port represented by the servicename and class.
|
public static int getPort(java.lang.String serviceName, java.lang.String type)
For exampel, given a line in /etc/services of http 80/tcp
A search for service "http" and type "tcp" returns
80
serviceName
- the service name.type
- the type of service (UDP/TCP)public static int getPort(java.lang.String serviceName)
getPort(String, String)