Top Description Methods
org.jboss.logmanager.handlers

public Interface ClientSocketFactory

Imports
java.io.IOException, java.net.DatagramSocket, .InetAddress, .InetSocketAddress, .Socket, .SocketAddress, .SocketException, javax.net.SocketFactory

A factory used to create writable sockets.
Author
James R. Perkins

Method Summary

Modifier and TypeMethod and Description
public DatagramSocket

Returns:

the newly created socket
createDatagramSocket
()

Creates a datagram socket for UDP communication.

public Socket

Returns:

the newly created socket
createSocket
()

Creates a TCP socket.

public InetAddress

Returns:

the address being used
getAddress
()

Returns the address being used to create sockets.

public int

Returns:

the port being used
getPort
()

Returns the port being used to create sockets.

public default SocketAddress

Returns:

a socket address
getSocketAddress
()

A convenience method to return the socket address.

public static ClientSocketFactory

Returns:

the client socket factory
of
(final InetAddress
the address to bind to
address
,
final int
the port to bind to
port
)

Creates a new default implementation of the factory which uses SocketFactory#getDefault() for TCP sockets and new DatagramSocket() for UDP sockets.

public static ClientSocketFactory

Returns:

the client socket factory
of
(final SocketFactory
the socket factory used for TCP connections, if null the default socket factory will be used
socketFactory
,
final InetAddress
the address to bind to
address
,
final int
the port to bind to
port
)

Creates a new default implementation of the factory which uses the provided socket factory to create TCP connections and new DatagramSocket() for UDP sockets.

Method Detail

createDatagramSocketback to summary
public DatagramSocket createDatagramSocket() throws SocketException

Creates a datagram socket for UDP communication.

Returns:DatagramSocket

the newly created socket

Exceptions
SocketException:
if binding the socket fails
createSocketback to summary
public Socket createSocket() throws IOException

Creates a TCP socket.

Returns:Socket

the newly created socket

Exceptions
IOException:
if an error occurs creating the socket
getAddressback to summary
public InetAddress getAddress()

Returns the address being used to create sockets.

Returns:InetAddress

the address being used

getPortback to summary
public int getPort()

Returns the port being used to create sockets.

Returns:int

the port being used

getSocketAddressback to summary
public default SocketAddress getSocketAddress()

A convenience method to return the socket address.

The default implementation simply returns new InetSocketAddress(getAddress(), getPort()).

Returns:SocketAddress

a socket address

ofback to summary
public static ClientSocketFactory of(final InetAddress address, final int port)

Creates a new default implementation of the factory which uses SocketFactory#getDefault() for TCP sockets and new DatagramSocket() for UDP sockets.

Parameters
address:InetAddress

the address to bind to

port:int

the port to bind to

Returns:ClientSocketFactory

the client socket factory

ofback to summary
public static ClientSocketFactory of(final SocketFactory socketFactory, final InetAddress address, final int port)

Creates a new default implementation of the factory which uses the provided socket factory to create TCP connections and new DatagramSocket() for UDP sockets.

Parameters
socketFactory:SocketFactory

the socket factory used for TCP connections, if null the default socket factory will be used

address:InetAddress

the address to bind to

port:int

the port to bind to

Returns:ClientSocketFactory

the client socket factory