public class SocketUtil extends Object
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns a free port number on localhost, or -1 if unable to find a free port.
@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 port
searchFrom- the port number from which to start searching
searchTo- the port number at which to stop searching
public static int findFreePort()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.