peerbase.socket
Class SocketFactory
java.lang.Object
peerbase.socket.SocketFactory
- Direct Known Subclasses:
- NormalSocketFactory
public abstract class SocketFactory
- extends java.lang.Object
Factory for socket implementations. Used by classes of the PeerBase
system to generate sockets appropriate for normal use, testing, or
educational purposes.
- Author:
- Nadeem Abdul Hamid
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketFactory
public SocketFactory()
getSocketFactory
public static SocketFactory getSocketFactory()
setSocketFactory
public static void setSocketFactory(SocketFactory sf)
makeSocket
public abstract SocketInterface makeSocket(java.lang.String host,
int port)
throws java.io.IOException,
java.net.UnknownHostException
- Constructs a new socket object, appropriate to the purpose
of the factory.
- Parameters:
host
- the host nameport
- the port number
- Returns:
- a socket connection object
- Throws:
java.io.IOException
java.net.UnknownHostException
makeSocket
public abstract SocketInterface makeSocket(java.net.Socket socket)
throws java.io.IOException
- Constructs a new SocketInterface object, encapsulating a standard Java
API Socket object.
- Parameters:
socket
- the socket to encapsulate
- Returns:
- a socket connection object
- Throws:
java.io.IOException