public class SocketUtil extends Object
Constructor and Description |
---|
SocketUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
findFreePort()
Returns a free port number on localhost, or -1 if unable to find a free port.
|
static int |
findUnusedLocalPort(String host,
int searchFrom,
int searchTo)
Deprecated.
Use
findFreePort() instead. It is possible that this
method can return a port that is already in use since the implementation does
not bind to the given port to ensure that it is free. |
@Deprecated public static int findUnusedLocalPort(String host, int searchFrom, int searchTo)
findFreePort()
instead. It is possible that this
method can return a port that is already in use since the implementation does
not bind to the given port to ensure that it is free.host
- name or IP address of host on which to find a free portsearchFrom
- the port number from which to start searchingsearchTo
- the port number at which to stop searchingpublic static int findFreePort()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.