SocketImpl Class Reference

Inherits ObjectImpl.

List of all members.


Detailed Description

Default Socket Implementation.

This implementation does not implement any security check.


Public Member Functions

 SocketImpl ()
 ~SocketImpl ()
void accept (SocketImplPtr s)
 Accepts a connection.
int available ()
 Returns the number of bytes that can be read from this socket without blocking.
void bind (InetAddressPtr host, int port)
 Binds this socket to the specified port number on the specified host.
void close ()
 Closes this socket.
void connect (InetAddressPtr address, int port)
 Connects this socket to the specified port number on the specified host.
void connect (const LogString &host, int port)
 Connects this socket to the specified port on the named host.
void create (bool stream)
 Creates either a stream or a datagram socket.
InetAddressPtr getInetAddress () const
 Returns the value of this socket's address field.
int getLocalPort () const
 Returns the value of this socket's localport field.
int getPort () const
 Returns the value of this socket's port field.
void listen (int backlog)
 Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
LogString toString () const
 Returns the address and port of this socket as a String.
size_t read (void *buf, size_t len) const
size_t write (const void *buf, size_t len)
int getSoTimeout () const
 Retrive setting for SO_TIMEOUT.
void setSoTimeout (int timeout)
 Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.

Protected Attributes

InetAddressPtr address
 The IP address of the remote end of this socket.
Pool memoryPool
 The APR memory pool to use for this socket.
apr_socket_t * socket
 The APR socket.
int localport
 The local port number to which this socket is connected.
int port
 The port number on the remote host to which this socket is connected.


Constructor & Destructor Documentation

SocketImpl  ) 
 

~SocketImpl  ) 
 


Member Function Documentation

void accept SocketImplPtr  s  ) 
 

Accepts a connection.

Parameters:
s the connection
Exceptions:
SocketTimeoutException if a timeout was previously set with setSoTimeout and the timeout has been reached.
SocketException if an I/O error occurs when accepting the connection

int available  ) 
 

Returns the number of bytes that can be read from this socket without blocking.

Returns:
the number of bytes that can be read from this socket without blocking.

void bind InetAddressPtr  host,
int  port
 

Binds this socket to the specified port number on the specified host.

Parameters:
host the host address
port the port number.
Exceptions:
BindException if an I/O error occurs when binding this socket.

void close  ) 
 

Closes this socket.

void connect const LogString host,
int  port
 

Connects this socket to the specified port on the named host.

void connect InetAddressPtr  address,
int  port
 

Connects this socket to the specified port number on the specified host.

void create bool  stream  ) 
 

Creates either a stream or a datagram socket.

InetAddressPtr getInetAddress  )  const [inline]
 

Returns the value of this socket's address field.

int getLocalPort  )  const [inline]
 

Returns the value of this socket's localport field.

int getPort  )  const [inline]
 

Returns the value of this socket's port field.

int getSoTimeout  )  const
 

Retrive setting for SO_TIMEOUT.

void listen int  backlog  ) 
 

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.

size_t read void *  buf,
size_t  len
const
 

void setSoTimeout int  timeout  ) 
 

Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.

LogString toString  )  const
 

Returns the address and port of this socket as a String.

size_t write const void *  buf,
size_t  len
 


Member Data Documentation

InetAddressPtr address [protected]
 

The IP address of the remote end of this socket.

int localport [protected]
 

The local port number to which this socket is connected.

Pool memoryPool [protected]
 

The APR memory pool to use for this socket.

int port [protected]
 

The port number on the remote host to which this socket is connected.

apr_socket_t* socket [protected]
 

The APR socket.


The documentation for this class was generated from the following file: