ot::net
class ServerSocketFactory
#include "ot/net/ServerSocketFactory.h"
A factory class for creating instances of ServerSocket.
A default implementation of ServerSocketFactory is provided which simply creates instances of the ServerSocket class. However, the ServerSocketFactory interface may be employed by applications (and elsewhere within OpenTop) to create customized derivatives of the ServerSocket class.
- Multi-threaded considerations:
-
Can safely be called from multiple concurrent threads.
- Since:
-
OpenTop 1.4
createServerSocket
virtual RefPtr< ServerSocket > createServerSocket()
-
Creates a ServerSocket that is not bound to an interface or port number.
Before the created ServerSocket can be used to accept incoming connection requests, ServerSocket::bind() must be called.
Use this method to create a ServerSocket when you need to set options that must be set before calling ServerSocket::bind() such as ServerSocket::setReuseAddress() and ServerSocket::setReceiveBufferSize().
- Exceptions:
SocketException -
if an error occurs whilst creating the socket.
- See also:
-
ServerSocket::bind() , ServerSocket::isBound()
createServerSocket
virtual RefPtr< ServerSocket > createServerSocket(int port)
-
Creates a ServerSocket that is bound to a specified port number.
The maximum queue length for incoming connection requests is set to a default value. If a connection request arrives when the queue is full, the request is refused.
- Parameters:
port -
the port number to bind to. If the port number is zero the system will assign an unused port number.
- Exceptions:
SocketException -
if an error occurs whilst creating the socket.
BindException -
if an error occurs whilst binding to the requested port.
createServerSocket
virtual RefPtr< ServerSocket > createServerSocket(int port,
int backlog)
-
Creates a ServerSocket that is bound to a specified port number with a specified queue size.
The maximum queue length for incoming connection requests is set to backlog. If a connection request arrives when the queue is full, the request is refused.
- Parameters:
port -
the port number to bind to. If the port number is zero the system will assign an unused port number.
backlog -
the maximum queue length for pending connection requests.
- Exceptions:
SocketException -
if an error occurs whilst creating the socket.
BindException -
if an error occurs whilst binding to the requested port.
createServerSocket
virtual RefPtr< ServerSocket > createServerSocket(int port,
int backlog,
InetAddress* pIfAddress)
-
Creates a ServerSocket that is bound to the port number port and the local network interface pIfAddress.
The maximum queue length for incoming connection requests is set to backlog. If a connection request arrives when the queue is full, the request is refused.
- Parameters:
port -
the port number to bind to. If the port number is zero the system will assign an unused port number.
backlog -
the maximum queue length for pending connection requests.
pIfAddress -
a pointer to an InetAddress representing the IP-address of a local network interface on which to listen for incoming requests.
- Exceptions:
SocketException -
if an error occurs whilst creating the socket.
BindException -
if an error occurs whilst binding to the requested port and IP-address.
NullPointerException -
if pBindAddr is null.
GetDefault
static RefPtr< ServerSocketFactory > GetDefault()
-
Returns the default implementation of the ServerSocketFactory class.
The default implementation can be used to create instances of the ServerSocket class.
- Multi-threaded considerations:
-
Can safely be called from multiple concurrent threads.
Found a bug or missing feature? Please email us at support@elcel.com