2005/5/9

     
 

class Socket

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::net::Socket Class Reference

#include <Socket.h>

Inheritance diagram for acdk::net::Socket:

acdk::lang::Object acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

API: Java.

Author:
Roger Rene Kommer, Maximilian Thoran
Version:
Revision
1.17
Date:
Date
2005/04/30 14:06:54


Public Member Functions

virtual ~Socket ()
 Socket (bool asStream=true)
 Creates an unconnected socket, with the system-default type of SocketImpl.

 Socket (IN(RInetAddress) address, int port, bool asStream=true)
 Creates a stream socket and connects it to the specified port number at the specified IP address.

 Socket (IN(RString) host, int port, bool asStream=true)
 Creates a stream socket and connects it to the specified port number on the named host.

bool connect (IN(RInetAddress) address, int port, int timeOut=-1)
 connect a unconnected socket.

bool connect (IN(RString) host, int port, int timeOut=-1)
 connect a unconnected socket.

void close ()
 Closes this socket.

RInetAddress getInetAddress ()
 Returns the address to which the socket is connected.

RReader getInputStream ()
 Returns an input stream for this socket.

RReader getReader ()
bool getKeepAlive ()
 Tests if SO_KEEPALIVE is enabled.

RInetAddress getLocalAddress ()
 Gets the local address to which the socket is bound.

int getLocalPort ()
 Returns the local port to which this socket is bound.

RWriter getOutputStream ()
 Returns an output stream for this socket.

RWriter getWriter ()
int getPort ()
 Returns the remote port to which this socket is connected.

int getReceiveBufferSize ()
 Get value of the SO_RCVBUF option for this socket, that is the buffer size used by the platform for input on the this Socket.

int getSendBufferSize ()
 Get value of the SO_SNDBUF option for this socket, that is the buffer size used by the platform for output on the this Socket.

int getSoLinger ()
 Returns setting for SO_LINGER.

int getSoTimeout ()
 Returns setting for SO_TIMEOUT.

bool getTcpNoDelay ()
 Tests if TCP_NODELAY is enabled.

void setKeepAlive (bool on)
 Enable/disable SO_KEEPALIVE.

bool getReuseAddress ()
 get SO_REUSEADDR flag

void setReuseAddress (bool on)
 set SO_REUSEADDR flag

void setReceiveBufferSize (int size)
 Sets the SO_RCVBUF option to the specified value for this DatagramSocket.

void setSendBufferSize (int size)
 Sets the SO_SNDBUF option to the specified value for this DatagramSocket.

void setSoLinger (bool on, int linger)
 Enable/disable SO_LINGER with the specified linger time in seconds.

void setSoTimeout (int timeout)
 Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.

void setTcpNoDelay (bool on)
 Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).

void shutdownInput ()
 Places the input stream for this socket at end of stream.

void shutdownOutput ()
 Disables the output stream for this socket.

RString toString ()
 Converts this socket to a String.


Static Public Member Functions

void setSocketImplFactory (IN(RSocketImplFactory) fac)
 Sets the client socket implementation factory for the application.


Protected Member Functions

 Socket (IN(RSocketImpl) impl)
 Creates an unconnected Socket with a user-specified SocketImpl.


Static Protected Member Functions

void _init ()

Protected Attributes

RSocketImpl _theSocket
bool _opened
bool _asStream

Static Protected Attributes

bool _initialised
RSocketImplFactory _theFactory
bool _factorychanged

Friends

class ServerSocket
 Noetig, damit ServerSocket den Konstruktor Socket( RSocketImpl ) benutzen kann.


Constructor & Destructor Documentation

virtual acdk::net::Socket::~Socket  )  [virtual]
 

acdk::net::Socket::Socket IN(RSocketImpl impl  )  [protected]
 

Creates an unconnected Socket with a user-specified SocketImpl.

acdk::net::Socket::Socket bool  asStream = true  ) 
 

Creates an unconnected socket, with the system-default type of SocketImpl.

you have to use connect() to connect to socket

acdk::net::Socket::Socket IN(RInetAddress address,
int  port,
bool  asStream = true
 

Creates a stream socket and connects it to the specified port number at the specified IP address.

acdk::net::Socket::Socket IN(RString host,
int  port,
bool  asStream = true
 

Creates a stream socket and connects it to the specified port number on the named host.


Member Function Documentation

void acdk::net::Socket::_init  )  [static, protected]
 

void acdk::net::Socket::close  ) 
 

Closes this socket.

bool acdk::net::Socket::connect IN(RString host,
int  port,
int  timeOut = -1
 

connect a unconnected socket.

if timeOut is != 0 this method may return false if socket cannot connect in the given time

bool acdk::net::Socket::connect IN(RInetAddress address,
int  port,
int  timeOut = -1
 

connect a unconnected socket.

if timeOut is != 0 this method may return false if socket cannot connect in the given time

RInetAddress acdk::net::Socket::getInetAddress  ) 
 

Returns the address to which the socket is connected.

RReader acdk::net::Socket::getInputStream  )  [inline]
 

Returns an input stream for this socket.

bool acdk::net::Socket::getKeepAlive  ) 
 

Tests if SO_KEEPALIVE is enabled.

RInetAddress acdk::net::Socket::getLocalAddress  ) 
 

Gets the local address to which the socket is bound.

int acdk::net::Socket::getLocalPort  )  [inline]
 

Returns the local port to which this socket is bound.

RWriter acdk::net::Socket::getOutputStream  )  [inline]
 

Returns an output stream for this socket.

int acdk::net::Socket::getPort  )  [inline]
 

Returns the remote port to which this socket is connected.

RReader acdk::net::Socket::getReader  )  [inline]
 

int acdk::net::Socket::getReceiveBufferSize  ) 
 

Get value of the SO_RCVBUF option for this socket, that is the buffer size used by the platform for input on the this Socket.

bool acdk::net::Socket::getReuseAddress  ) 
 

get SO_REUSEADDR flag

int acdk::net::Socket::getSendBufferSize  ) 
 

Get value of the SO_SNDBUF option for this socket, that is the buffer size used by the platform for output on the this Socket.

int acdk::net::Socket::getSoLinger  ) 
 

Returns setting for SO_LINGER.

int acdk::net::Socket::getSoTimeout  ) 
 

Returns setting for SO_TIMEOUT.

bool acdk::net::Socket::getTcpNoDelay  ) 
 

Tests if TCP_NODELAY is enabled.

RWriter acdk::net::Socket::getWriter  )  [inline]
 

void acdk::net::Socket::setKeepAlive bool  on  ) 
 

Enable/disable SO_KEEPALIVE.

void acdk::net::Socket::setReceiveBufferSize int  size  ) 
 

Sets the SO_RCVBUF option to the specified value for this DatagramSocket.

void acdk::net::Socket::setReuseAddress bool  on  ) 
 

set SO_REUSEADDR flag

void acdk::net::Socket::setSendBufferSize int  size  ) 
 

Sets the SO_SNDBUF option to the specified value for this DatagramSocket.

void acdk::net::Socket::setSocketImplFactory IN(RSocketImplFactory fac  )  [static]
 

Sets the client socket implementation factory for the application.

void acdk::net::Socket::setSoLinger bool  on,
int  linger
 

Enable/disable SO_LINGER with the specified linger time in seconds.

void acdk::net::Socket::setSoTimeout int  timeout  ) 
 

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

void acdk::net::Socket::setTcpNoDelay bool  on  ) 
 

Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).

void acdk::net::Socket::shutdownInput  ) 
 

Places the input stream for this socket at end of stream.

void acdk::net::Socket::shutdownOutput  ) 
 

Disables the output stream for this socket.

RString acdk::net::Socket::toString  )  [virtual]
 

Converts this socket to a String.

Reimplemented from acdk::lang::Object.


Friends And Related Function Documentation

friend class ServerSocket [friend]
 

Noetig, damit ServerSocket den Konstruktor Socket( RSocketImpl ) benutzen kann.


Member Data Documentation

bool acdk::net::Socket::_asStream [protected]
 

bool acdk::net::Socket::_factorychanged [static, protected]
 

bool acdk::net::Socket::_initialised [static, protected]
 

bool acdk::net::Socket::_opened [protected]
 

RSocketImplFactory acdk::net::Socket::_theFactory [static, protected]
 

RSocketImpl acdk::net::Socket::_theSocket [protected]