Ceylan::Network::Socket Class Reference

Simple general socket I/O class, both for connection-based (stream) sockets and packet-based (datagram) sockets, both for client-side and server-side sockets. More...

#include <CeylanSocket.h>

Inheritance diagram for Ceylan::Network::Socket:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Network::Socket:

Collaboration graph
[legend]

List of all members.

Classes

class  SocketException
 Mother class for all socket-related exceptions. More...

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

virtual ~Socket () throw ()
 Virtual destructor.
virtual bool isConnected () const =0
 Tells whether this socket is currently connected to a peer.
virtual bool hasAvailableData () const
 Tells whether there is data available on input, i.e.
virtual System::Size read (char *buffer, System::Size maxLength)
 Reads up to maxLength bytes from this socket to specified buffer.
virtual System::Size write (const std::string &message)
 Writes message to this socket.
virtual System::Size write (const char *buffer, System::Size maxLength)
 Writes up to maxLength bytes from the specified buffer to this socket.
System::FileDescriptor getOriginalFileDescriptor () const
 Returns the original file descriptor associated with the socket on its creation.
virtual System::FileDescriptor getFileDescriptorForTransport () const
 Returns the file descriptor that should be used for that socket to communicate with its peer(s).
virtual Port getLocalPort () const
 Returns the local port number of the socket.
virtual Port getPeerPort () const
 Returns the remote port number this socket is linked to, i.e.
virtual IPAddressgetLocalIPAddress () const
 Returns the local IP address corresponding to this socket.
virtual IPAddressgetPeerIPAddress () const
 Returns the remote IP address this socket is linked to, i.e.
virtual System::StreamID getInputStreamID () const
 Returns the file descriptor for this socket, which is a StreamID.
virtual System::StreamID getOutputStreamID () const
 Returns the file descriptor for this socket, which is a StreamID.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.
bool isSelected () const
 Tells if the stream has data to read.
bool isFaulty () const
virtual void clearInput ()
 Clears the input stream.
virtual Ceylan::Sint8 readSint8 ()
 Returns a Ceylan::Sint8 read from this input stream.
virtual Ceylan::Uint8 readUint8 ()
 Returns a Ceylan::Uint8 read from this input stream.
virtual Ceylan::Sint16 readSint16 ()
 Returns a Ceylan::Sint16 read from this input stream.
virtual Ceylan::Uint16 readUint16 ()
 Returns a Ceylan::Uint16 read from this input stream.
virtual Ceylan::Sint32 readSint32 ()
 Returns a Ceylan::Sint32 read from this input stream.
virtual Ceylan::Uint32 readUint32 ()
 Returns a Ceylan::Uint32 read from this input stream.
virtual Ceylan::Float32 readFloat32 ()
 Returns a Ceylan::Float32 read from this input stream.
virtual Ceylan::Float64 readFloat64 ()
 Returns a Ceylan::Float64 read from this input stream.
virtual void readString (std::string &result)
 Reads a string from this input stream, and stores it in the specified string.
virtual void skipWhitespaces (Ceylan::Uint8 &firstNonSpace)
 Reads from this input stream as long as there are whitespaces to be read.
bool isBlocking () const
 Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).
virtual void writeSint8 (Ceylan::Sint8 toWrite)
 Writes a Ceylan::Sint8 to this output stream.
virtual void writeUint8 (Ceylan::Uint8 toWrite)
 Writes a Ceylan::Uint8 to this output stream.
virtual void writeSint16 (Ceylan::Sint16 toWrite)
 Writes a Ceylan::Sint16 to this output stream.
virtual void writeUint16 (Ceylan::Uint16 toWrite)
 Writes a Ceylan::Uint16 to this output stream.
virtual void writeSint32 (Ceylan::Sint32 toWrite)
 Writes a Ceylan::Sint32 to this output stream.
virtual void writeUint32 (Ceylan::Uint32 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeFloat32 (Ceylan::Float32 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeFloat64 (Ceylan::Float64 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeString (const std::string &toWrite)
 Writes a string to this output stream.

Static Public Member Functions

static Ceylan::Uint16 Select (std::list< InputStream * > &is)
 Blocks the calling thread until bytes become available on one or more streams in is.
static Ceylan::Uint16 Test (std::list< InputStream * > &is)
 Checks whether bytes become available on one or more streams in is.
static bool Close (FileDescriptor &fd)
 Closes and zeroes the specified file descriptor.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

 Socket (bool blocking=true)
 Client-side constructor.
 Socket (Port localPort, bool blocking=true)
 Server-side constructor.
virtual void createSocket (Port localPort)=0
 Returns the socket address structure reference of the connected peer, if any.
virtual bool close ()
 Closes the socket.
virtual void setBlocking (bool newStatus)
 Sets the blocking mode of this socket.
virtual void setSelected (bool newStatus)
 Used to set the selection status of this stream.
void setFaulty (bool newFaultyState=true)
 Sets the faulty state of this stream.
virtual void setStreamID (StreamID newInputStreamID)
 Sets this input stream's unique ID.

Protected Attributes

Port _port
 The port this socket is created with.
SystemSpecificSocketAddress * _address
 The system-specific socket address for this socket.
System::FileDescriptor _originalFD
 Internal file descriptor, used if this feature is available.
bool _isBlocking
 Stores whether the stream is in blocking mode.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 Socket (const Socket &source)
 Copy constructor made private to ensure that it will be never called.
Socketoperator= (const Socket &source)
 Assignment operator made private to ensure that it will be never called.


Detailed Description

Simple general socket I/O class, both for connection-based (stream) sockets and packet-based (datagram) sockets, both for client-side and server-side sockets.

Designed to be subclassed.

See also:
StreamSocket

DatagramSocket when available

Definition at line 93 of file CeylanSocket.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Socket::~Socket (  )  throw () [virtual]

Virtual destructor.

Definition at line 202 of file CeylanSocket.cc.

References _address, close(), dataUtils::e, and Ceylan::Exception::toString().

Socket::Socket ( bool  blocking = true  )  [explicit, protected]

Client-side constructor.

Parameters:
blocking tells whether this socket should be created in blocking mode (the default) or in non-blocking mode.
Exceptions:
SocketException if the operation failed.

Definition at line 132 of file CeylanSocket.cc.

References _address, and setBlocking().

Socket::Socket ( Port  localPort,
bool  blocking = true 
) [protected]

Server-side constructor.

Parameters:
localPort the local port to bind to.
blocking tells whether this socket should be created in blocking mode (the default) or in non-blocking mode.
Exceptions:
SocketException if the operation failed.

Definition at line 165 of file CeylanSocket.cc.

References _address, and setBlocking().

Ceylan::Network::Socket::Socket ( const Socket source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void InputStream::clearInput (  )  [virtual, inherited]

Clears the input stream.

Exceptions:
InputStream::ReadFailedException if the operation failed.

Reimplemented in Ceylan::System::Pipe.

Definition at line 179 of file CeylanInputStream.cc.

References dataUtils::b, Ceylan::System::InputStream::hasAvailableData(), and Ceylan::System::InputStream::read().

bool Stream::Close ( FileDescriptor fd  )  [static, inherited]

Closes and zeroes the specified file descriptor.

It is passed by address so that this function can set it to zero on successful close.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed.

Definition at line 114 of file CeylanStream.cc.

References Ceylan::System::Stream::close(), generalUtils::false, Ceylan::toString(), and generalUtils::true.

Referenced by Ceylan::System::StandardFile::close(), close(), Ceylan::System::Pipe::close(), and Ceylan::System::LibfatFile::close().

bool Socket::close (  )  [protected, virtual]

Closes the socket.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed.

Implements Ceylan::System::Stream.

Definition at line 553 of file CeylanSocket.cc.

References _originalFD, Ceylan::System::Stream::Close(), Ceylan::Network::explainSocketError(), generalUtils::false, and generalUtils::true.

Referenced by Ceylan::Network::ClientStreamSocket::disconnect(), and ~Socket().

virtual void Ceylan::Network::Socket::createSocket ( Port  localPort  )  [protected, pure virtual]

Returns the socket address structure reference of the connected peer, if any.

Exceptions:
SocketException if there is no connected peer, or FeatureNotAvailableException if the network feature is not available.
virtual SystemSpecificSocketAddress & getAddress() ; Creates the socket associated with the port port.

Parameters:
localPort the specified local port.
Exceptions:
SocketException if the operation failed.
Note:
It is the place where socket attributes are effectively set (ex: non-blocking).

Implemented in Ceylan::Network::StreamSocket.

FileDescriptor Socket::getFileDescriptorForTransport (  )  const [virtual]

Returns the file descriptor that should be used for that socket to communicate with its peer(s).

Note:
Depending on this socket being client-side or server-side, it may use a different file descriptor from the original one, this method tells which one is to be used to read or write data.
Exceptions:
SocketException if the operation failed, or FeatureNotAvailableException if the file descriptor feature is not available.
See also:
getOriginalFileDescriptor

Reimplemented in Ceylan::Network::SequentialServerStreamSocket.

Definition at line 389 of file CeylanSocket.cc.

References _originalFD.

Referenced by getInputStreamID(), getOutputStreamID(), hasAvailableData(), Ceylan::Network::StreamSocket::setNagleAlgorithmTo(), toString(), and write().

StreamID Socket::getInputStreamID (  )  const [virtual]

Returns the file descriptor for this socket, which is a StreamID.

Exceptions:
InputStreamException if no identifier is available, or if the file descriptor feature is not available.

Implements Ceylan::System::InputStream.

Definition at line 446 of file CeylanSocket.cc.

References getFileDescriptorForTransport(), and Ceylan::Exception::toString().

IPAddress * Socket::getLocalIPAddress (  )  const [virtual]

Returns the local IP address corresponding to this socket.

Ownership of the returned object is transferred to the caller, which has to deallocate it when of no more use.

Note:
It is not an obvious question, since computers may have more than one interface, and often the socket are bound thanks to INADDR_ANY, which means any interface.
Exceptions:
SocketException if this operation failed.

Definition at line 426 of file CeylanSocket.cc.

Port Socket::getLocalPort (  )  const [virtual]

Returns the local port number of the socket.

Exceptions:
SocketException if this operation failed.

Reimplemented in Ceylan::Network::ServerStreamSocket.

Definition at line 408 of file CeylanSocket.cc.

Referenced by toString().

FileDescriptor Socket::getOriginalFileDescriptor (  )  const

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

StreamID Socket::getOutputStreamID (  )  const [virtual]

Returns the file descriptor for this socket, which is a StreamID.

Exceptions:
OutputStreamException if no identifier is available, or if the file descriptor feature is not available.

Implements Ceylan::System::OutputStream.

Definition at line 473 of file CeylanSocket.cc.

References getFileDescriptorForTransport(), and Ceylan::Exception::toString().

IPAddress * Socket::getPeerIPAddress (  )  const [virtual]

Returns the remote IP address this socket is linked to, i.e.

the IP address of the peer of this socket.

Exceptions:
SocketException if this operation failed, including if this socket is not connected.

Definition at line 436 of file CeylanSocket.cc.

Port Socket::getPeerPort (  )  const [virtual]

Returns the remote port number this socket is linked to, i.e.

the port of the peer of this socket.

Exceptions:
SocketException if this operation failed, including if this socket is not connected.

Reimplemented in Ceylan::Network::ClientStreamSocket.

Definition at line 417 of file CeylanSocket.cc.

bool Socket::hasAvailableData (  )  const [virtual]

Tells whether there is data available on input, i.e.

on the file descriptor used for transport.

Implements Ceylan::System::InputStream.

Definition at line 226 of file CeylanSocket.cc.

References dataUtils::e, generalUtils::false, getFileDescriptorForTransport(), Ceylan::System::HasAvailableData(), and Ceylan::Exception::toString().

bool Stream::isBlocking (  )  const [inherited]

Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).

Definition at line 93 of file CeylanStream.cc.

References Ceylan::System::Stream::_isBlocking.

Referenced by Ceylan::Network::StreamSocket::createSocket(), and toString().

virtual bool Ceylan::Network::Socket::isConnected (  )  const [pure virtual]

bool InputStream::isFaulty (  )  const [inherited]

bool InputStream::isSelected (  )  const [inherited]

Tells if the stream has data to read.

Definition at line 122 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::_isSelected.

Referenced by Ceylan::System::InputStream::toString().

Socket& Ceylan::Network::Socket::operator= ( const Socket source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

virtual System::Size Ceylan::Network::Socket::read ( char *  buffer,
System::Size  maxLength 
) [virtual]

Reads up to maxLength bytes from this socket to specified buffer.

Parameters:
buffer the buffer where to store read bytes. Its size must be at least maxLength bytes.
maxLength the maximum number of bytes that should be read.
Returns:
The number of bytes actually read, which should be maxLength or lower.
Exceptions:
ReadFailedException if a read error occurred.

Reimplemented from Ceylan::System::InputStream.

Ceylan::Float32 InputStream::readFloat32 (  )  [virtual, inherited]

Returns a Ceylan::Float32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 356 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeFloat32().

Ceylan::Float64 InputStream::readFloat64 (  )  [virtual, inherited]

Returns a Ceylan::Float64 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 392 of file CeylanInputStream.cc.

References Ceylan::byteswap(), ceylan_bswap_64, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeFloat64().

Ceylan::Sint16 InputStream::readSint16 (  )  [virtual, inherited]

Returns a Ceylan::Sint16 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 239 of file CeylanInputStream.cc.

References ceylan_bswap_16, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint16().

Ceylan::Sint32 InputStream::readSint32 (  )  [virtual, inherited]

Returns a Ceylan::Sint32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 298 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint32().

Ceylan::Sint8 InputStream::readSint8 (  )  [virtual, inherited]

Returns a Ceylan::Sint8 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 203 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint8().

void InputStream::readString ( std::string &  result  )  [virtual, inherited]

Reads a string from this input stream, and stores it in the specified string.

Note:
Read strings can have no more than 65535 characters.
Parameters:
result the string to fill from this input stream.
Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 437 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::read(), Ceylan::System::InputStream::readUint16(), and Ceylan::toString().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeString().

Ceylan::Uint16 InputStream::readUint16 (  )  [virtual, inherited]

Returns a Ceylan::Uint16 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 268 of file CeylanInputStream.cc.

References ceylan_bswap_16, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeUint16(), and Ceylan::System::InputStream::readString().

Ceylan::Uint32 InputStream::readUint32 (  )  [virtual, inherited]

Returns a Ceylan::Uint32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 327 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeUint32().

Ceylan::Uint8 InputStream::readUint8 (  )  [virtual, inherited]

Ceylan::Uint16 InputStream::Select ( std::list< InputStream * > &  is  )  [static, inherited]

Blocks the calling thread until bytes become available on one or more streams in is.

To see which are selected, use the isSelected method.

Returns:
the number of selected streams.
See also:
the non-blocking version, Test.
Exceptions:
SelectFailedException if the operation failed, for example if the file descriptor feature is not available on this platform.

Definition at line 534 of file CeylanInputStream.cc.

References Ceylan::System::explainError(), Ceylan::Network::explainSocketError(), Ceylan::System::getError(), Ceylan::Network::getSocketError(), Ceylan::System::Thread::Sleep(), and Ceylan::toString().

Referenced by Ceylan::Network::MultiplexedServerStreamSocket::run().

void Socket::setBlocking ( bool  newStatus  )  [protected, virtual]

Sets the blocking mode of this socket.

Parameters:
newStatus if true, sets the socket in blocking mode, if false set to non-blocking mode. If the socket is already in the target state, nothing is done.
Exceptions:
NonBlockingNotSupportedException if the operation failed.

Reimplemented from Ceylan::System::Stream.

Reimplemented in Ceylan::Network::StreamSocket.

Definition at line 596 of file CeylanSocket.cc.

References Ceylan::System::Stream::_isBlocking.

Referenced by Socket().

void InputStream::setFaulty ( bool  newFaultyState = true  )  [protected, inherited]

Sets the faulty state of this stream.

Parameters:
newFaultyState the new faulty state.

Definition at line 1004 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::_isFaulty.

Referenced by Ceylan::Network::MultiplexedServerStreamSocket::run().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

void InputStream::setSelected ( bool  newStatus  )  [protected, virtual, inherited]

void InputStream::setStreamID ( StreamID  newInputStreamID  )  [protected, virtual, inherited]

Sets this input stream's unique ID.

Exceptions:
InputStreamException in all cases as long as not specifically overriden.

Definition at line 1013 of file CeylanInputStream.cc.

void InputStream::skipWhitespaces ( Ceylan::Uint8 firstNonSpace  )  [virtual, inherited]

Reads from this input stream as long as there are whitespaces to be read.

Parameters:
firstNonSpace the variable which will be set by this method to the value of the first non-whitespace character that is read.

Definition at line 516 of file CeylanInputStream.cc.

References Ceylan::isWhitespace(), and Ceylan::System::InputStream::readUint8().

Referenced by Ceylan::XML::XMLParser::handleNextElement().

Ceylan::Uint16 InputStream::Test ( std::list< InputStream * > &  is  )  [static, inherited]

Checks whether bytes become available on one or more streams in is.

To see which are selected, use the isSelected method.

This method returns always immediatly.

Returns:
the number of selected streams.
See also:
the blocking version, Select.
Exceptions:
SelectFailedException if the operation failed, for example if the file descriptor feature is not available on this platform.

Definition at line 863 of file CeylanInputStream.cc.

References Ceylan::System::explainError(), and Ceylan::System::getError().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const std::string Socket::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

virtual System::Size Ceylan::Network::Socket::write ( const char *  buffer,
System::Size  maxLength 
) [virtual]

Writes up to maxLength bytes from the specified buffer to this socket.

Parameters:
buffer the buffer where to find bytes that must be written to this socket. Its size must be at least maxLength bytes.
Returns:
The number of bytes actually written, which should be equal to maxLength.
Exceptions:
WriteFailedException if a write error occurred.

Reimplemented from Ceylan::System::OutputStream.

Size Socket::write ( const std::string &  message  )  [virtual]

Writes message to this socket.

Parameters:
message the message to write to this socket.
Returns:
The number of bytes actually written, which should be equal to the size of the string or lower.
Exceptions:
WriteFailedException if a write error occurred.

Reimplemented from Ceylan::System::OutputStream.

Definition at line 294 of file CeylanSocket.cc.

References Ceylan::System::explainError(), Ceylan::System::FDWrite(), getFileDescriptorForTransport(), and Ceylan::Exception::toString().

void OutputStream::writeFloat32 ( Ceylan::Float32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 219 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat32().

void OutputStream::writeFloat64 ( Ceylan::Float64  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 247 of file CeylanOutputStream.cc.

References Ceylan::byteswap(), ceylan_bswap_64, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat64().

void OutputStream::writeSint16 ( Ceylan::Sint16  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint16 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 119 of file CeylanOutputStream.cc.

References ceylan_bswap_16, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint16().

void OutputStream::writeSint32 ( Ceylan::Sint32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 169 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint32().

void OutputStream::writeSint8 ( Ceylan::Sint8  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint8 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 89 of file CeylanOutputStream.cc.

References Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint8().

void OutputStream::writeString ( const std::string &  toWrite  )  [virtual, inherited]

Writes a string to this output stream.

Note:
Written strings cannot have more than 65535 characters.
Parameters:
toWrite the string to write to this output stream.
Exceptions:
WriteFailedException in case a system error occured.

Definition at line 286 of file CeylanOutputStream.cc.

References Ceylan::Log::LogPlug::debug(), Ceylan::toString(), Ceylan::Uint16Max, Ceylan::System::OutputStream::write(), and Ceylan::System::OutputStream::writeUint16().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeString().

void OutputStream::writeUint16 ( Ceylan::Uint16  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint16 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 144 of file CeylanOutputStream.cc.

References ceylan_bswap_16, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint16(), and Ceylan::System::OutputStream::writeString().

void OutputStream::writeUint32 ( Ceylan::Uint32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 194 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint32().

void OutputStream::writeUint8 ( Ceylan::Uint8  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint8 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 104 of file CeylanOutputStream.cc.

References Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint8(), and Ceylan::XML::XMLSavingVisitor::visit().


Member Data Documentation

SystemSpecificSocketAddress* Ceylan::Network::Socket::_address [protected]

The system-specific socket address for this socket.

It will be used by server sockets to bind to the target port, whereas client sockets will use it to connect to the target server, and anonymous sockets will store informations about the client.

Definition at line 454 of file CeylanSocket.h.

Referenced by Ceylan::Network::AnonymousStreamSocket::AnonymousStreamSocket(), Ceylan::Network::ClientStreamSocket::connect(), Ceylan::Network::StreamSocket::createSocket(), Ceylan::Network::ServerStreamSocket::prepareToAccept(), Socket(), and ~Socket().

bool Ceylan::System::Stream::_isBlocking [protected, inherited]

Stores whether the stream is in blocking mode.

Definition at line 221 of file CeylanStream.h.

Referenced by Ceylan::System::Stream::isBlocking(), Ceylan::Network::StreamSocket::setBlocking(), setBlocking(), and Ceylan::System::Stream::toString().

Internal file descriptor, used if this feature is available.

The local port this socket will be bound to.

This is the original file descriptor for this socket. Depending on the specialization of this socket, it may or may not be the file descriptor that is used for transport.

Note:
The Windows SOCKET datatype is mapped here to a file descriptor.

Definition at line 472 of file CeylanSocket.h.

Referenced by Ceylan::Network::AnonymousStreamSocket::AnonymousStreamSocket(), close(), Ceylan::Network::StreamSocket::createSocket(), getFileDescriptorForTransport(), getOriginalFileDescriptor(), and Ceylan::Network::AnonymousStreamSocket::toString().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

The port this socket is created with.

For client sockets, the port of the remote server will be recorded here.

For server sockets, it will be the local port where the server will be listening.

Definition at line 441 of file CeylanSocket.h.

Referenced by Ceylan::Network::StreamSocket::createSocket(), Ceylan::Network::ServerStreamSocket::getLocalPort(), Ceylan::Network::ClientStreamSocket::getPeerPort(), and Ceylan::Network::StreamSocket::StreamSocket().


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

Generated on Thu Jun 4 20:40:45 2009 for Ceylan by  doxygen 1.5.8