Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.launching
Class SocketUtil

java.lang.Object
  extended by 
org.eclipse.jdt.launching.SocketUtil

public class SocketUtil
extends Object

Utility class to find a port to debug on.

Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.

Constructor Summary
SocketUtil ()
           
 
Method Summary
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.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketUtil

public SocketUtil()
Method Detail

findUnusedLocalPort

public 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.

Returns a free port number on the specified host within the given range, or -1 if none found.

Parameters:
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
Returns:
a free port in the specified range, or -1 of none found

findFreePort

public static int findFreePort()
Returns a free port number on localhost, or -1 if unable to find a free port.

Returns:
a free port number on localhost, or -1 if unable to find a free port
Since:
3.0

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire