Cross-Platform C++

ot::net
class ServerSocketFactory

#include "ot/net/ServerSocketFactory.h"

ot::ManagedObject ot::ssl::SSLServerSocketFactory 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



Method Summary
 virtual RefPtr< ServerSocket > createServerSocket()
         Creates a ServerSocket that is not bound to an interface or port number.
 virtual RefPtr< ServerSocket > createServerSocket(int port)
         Creates a ServerSocket that is bound to a specified port number.
 virtual RefPtr< ServerSocket > createServerSocket(int port, int backlog)
         Creates a ServerSocket that is bound to a specified port number with a specified queue size.
 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.
static RefPtr< ServerSocketFactory > GetDefault()
         Returns the default implementation of the ServerSocketFactory class.

Methods inherited from class ot::ManagedObject
addRef(), getRefCount(), onFinalRelease(), operator=(const ManagedObject&), release()

Method Detail

createServerSocket

virtual RefPtr< ServerSocketcreateServerSocket()
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< ServerSocketcreateServerSocket(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< ServerSocketcreateServerSocket(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< ServerSocketcreateServerSocket(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.


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2005 ElCel Technology   Trademark Acknowledgements