jmri.util
Class SocketUtil

java.lang.Object
  extended by jmri.util.SocketUtil

public class SocketUtil
extends Object

Common utility methods for working with Sockets.

We needed a place to refactor common socket-handling idioms in JMRI code, so this class was created. It's more of a library of procedures than a real class, as (so far) all of the operations have needed no state information.

In some cases, these routines use a Java 1.3 or later method, falling back to an explicit implementation when running on Java 1.1

Author:
Bob Jacobsen Copyright 2006

Constructor Summary
SocketUtil()
           
 
Method Summary
static String getRemoteSocketAddress(Socket socket)
          Return the remote address, if possible, otherwise ""
static void setReuseAddress(ServerSocket socket, boolean on)
          Set the Socket's reuseAddress parameter while protecting against failure
 
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

getRemoteSocketAddress

public static String getRemoteSocketAddress(Socket socket)
Return the remote address, if possible, otherwise ""


setReuseAddress

public static void setReuseAddress(ServerSocket socket,
                                   boolean on)
Set the Socket's reuseAddress parameter while protecting against failure



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads