OLServerSocket Class Reference
[Sockets]

A socket that can accept connections from clients. More...

#import <ObjectiveLib/Socket.h>

Inheritance diagram for OLServerSocket:

Inheritance graph
[legend]
List of all members.

Public Member Functions

(OLSocket *) - acceptConnection
 Accept a connection.
(void) - bindToAddress:
 Bind the socket to a local address.
(unsigned) - queueLength
 Return the queue length.
Initializers and Deallocators
(id) - init
 Initialize the socket.
(id) - initWithLocalAddress:
 Initialize the socket.
(id) - initWithLocalAddress:queueLength:
 Initialize the socket.
(id) - initWithQueueLength:
 Initialize the socket.

Protected Attributes

unsigned queueLength
 The number of clients that can be made to wait at any given time.

Detailed Description

A socket that can accept connections from clients.

A server socket typically binds itself to a local address, and then waits for connections to come in via acceptConnection (OLServerSocket). When a connection is received a new socket is returned that can be used to communicate with the client, while the server typically returns to waiting for connections by calling acceptConnection (OLServerSocket) again. This model of usage usually occurs in a multithreaded or multiprocess environment.

See also:
OLClientSocket


Member Function Documentation

- (OLSocket*) acceptConnection  

Accept a connection.

This method will block until a connection is received. The returned socket can be used to communicate with the client that has initiated the connection.

Exceptions:
OLSocketException if there is a problem attempting to accept a connection
Returns:
a new socket that is connected to the client that initiated the connection

- (void) bindToAddress: (OLSocketAddress *)  address  

Bind the socket to a local address.

After successfully sending this message the socket will be assigned the local address.

Exceptions:
OLSocketException if there is a problem binding the socket
Parameters:
address the address that should be assigned to the socket

Reimplemented from OLBindableSocket.

Reimplemented in OLUnixServerSocket.

- (id) init  

Initialize the socket.

The socket remains unbound to a local address and has a queue length of 50.

Exceptions:
OLSocketException if the socket cannot be initialized
Returns:
a reference to this socket

- (id) initWithLocalAddress: (OLSocketAddress *)  address  

Initialize the socket.

The socket is bound to address and has a queue length of 50.

Exceptions:
OLSocketException if the socket cannot be initialized
Parameters:
address the local address to which this socket should be bound
Returns:
a reference to this socket

- (id) initWithLocalAddress: (OLSocketAddress *)  address
queueLength: (unsigned)  qLen 

Initialize the socket.

The socket is bound to address and has a queue length of qLen.

Exceptions:
OLSocketException if the socket cannot be initialized
Parameters:
address the local address to which this socket should be bound
qLen the length of the server's queue
Returns:
a reference to this socket

- (id) initWithQueueLength: (unsigned)  qLen  

Initialize the socket.

The socket remains unbound to a local address and has a queue length of qLen.

Exceptions:
OLSocketException if the socket cannot be initialized
Parameters:
qLen the length of the server's queue
Returns:
a reference to this socket

- (unsigned) queueLength  

Return the queue length.

The queue length represents the number of clients that can wait at any given time for a server to accept a connection to them.

Returns:
the queue length


Member Data Documentation

- (unsigned) queueLength [protected]

The number of clients that can be made to wait at any given time.


The documentation for this class was generated from the following file:
ObjectiveLibGenerated Sun Apr 22 15:19:03 2007, © 2004-2007 Will Mason
SourceForge.net Logo