A reliable, connection-oriented stream (TCP) socket. More...
#include <StreamSocket.h++>

Public Member Functions | |
| StreamSocket (uint16_t port=0) throw () | |
| Construct a new StreamSocket. | |
| ~StreamSocket () throw () | |
| Destructor. | |
| void | connect (const String &addr, uint16_t port) throw (IOException) |
| Connect the socket to a remote endpoint. | |
| void | connect (const SocketAddress &addr) throw (IOException) |
| Connect the socket to a remote endpoint. | |
| size_t | read (byte_t *buffer, size_t buflen) throw (IOException) |
| Read data from the stream into a raw buffer. | |
| size_t | write (const byte_t *buffer, size_t buflen) throw (IOException) |
| Write data to the stream from a raw buffer, until either the entire buffer is written or an error or timeout occurs. | |
| size_t | read (ByteBuffer &buffer) throw (IOException) |
| Read data from the stream into a ByteBuffer. | |
| size_t | write (ByteBuffer &buffer) throw (IOException) |
| Write data to the stream from a ByteBuffer. | |
| size_t | read (CharBuffer &buffer) throw (IOException) |
| Read data from the stream into a CharBuffer. | |
| size_t | write (CharBuffer &buffer) throw (IOException) |
| Write data to the stream from a CharBuffer. | |
| size_t | read (byte_t *buffer, size_t buflen, int64_t offset, AsyncIOTask &task) throw (IOException) |
| Read data asynchronously from the stream into a raw buffer. | |
| size_t | write (const byte_t *buffer, size_t buflen, int64_t offset, AsyncIOTask &task) throw (IOException) |
| Write data asynchronously to the stream from a raw buffer. | |
| size_t | read (ByteBuffer &buffer, int64_t offset, AsyncIOTask &task) throw (IOException) |
| Read data asynchronously from the stream into a Buffer. | |
| size_t | write (ByteBuffer &buffer, int64_t offset, AsyncIOTask &task) throw (IOException) |
| Write data asynchronously to the stream from a Buffer. | |
| size_t | read (MemoryBlock *vec, uint_t count) throw (IOException) |
| Read data from the stream into a series of I/O buffers. | |
| size_t | write (const MemoryBlock *vec, uint_t count) throw (IOException) |
| Write data to the stream from a series of I/O buffers. | |
| byte_t | readOOB () throw (IOException) |
| Read a byte of out-of-band data from the socket. | |
| void | writeOOB (byte_t data) throw (IOException) |
| Write a byte of out-of-band data to the socket. | |
| void | close (IOMode mode=IOReadWrite) throw () |
| Close the stream for reading, writing, or both. | |
| virtual void | shutdown () throw () |
| Shut down the socket. | |
| void | setTimeout (timespan_ms_t timeout) throw (IOException) |
| Set the timeout for the socket. | |
| template<typename T > | |
| size_t | read (Buffer< T > &buffer, size_t &partial) throw (IOException) |
| Read data from the stream into a Buffer of arbitrary type. | |
| template<typename T > | |
| size_t | write (Buffer< T > &buffer, size_t &partial) throw (IOException) |
| Write data to the stream from a Buffer of arbitrary type. | |
| virtual size_t | readFully (ByteBuffer &buffer, size_t count=0) throw (IOException) |
| Read data from the stream into a ByteBuffer, until either the buffer is full or an error or timeout occurs. | |
| virtual size_t | readFully (CharBuffer &buffer, size_t count=0) throw (IOException) |
| Read data from the stream into a CharBuffer, until either the buffer is full or an error or timeout occurs. | |
| template<typename T > | |
| size_t | readFully (Buffer< T > &buffer, size_t &partial) throw (IOException) |
| Read data from the stream into a Buffer of arbitrary type, until either the buffer is full or an error or timeout occurs. | |
| virtual size_t | readFully (byte_t *buffer, size_t buflen) throw (IOException) |
| Read data from the stream into a raw buffer, until either the buffer is full or an error or timeout occurs. | |
| virtual size_t | writeFully (ByteBuffer &buffer) throw (IOException) |
| Write data to the stream from a ByteBuffer, until either the entire buffer is written or an error or timeout occurs. | |
| virtual size_t | writeFully (CharBuffer &buffer) throw (IOException) |
| Write data to the stream from a CharBuffer, until either the entire buffer is written or an error or timeout occurs. | |
| template<typename T > | |
| size_t | writeFully (Buffer< T > &buffer, size_t &partial) throw (IOException) |
| Write data to the stream from a Buffer of arbitrary type, until either the entire buffer is written or an error or timeout occurs. | |
| virtual size_t | writeFully (const byte_t *buffer, size_t buflen) throw (IOException) |
| Write data to the stream from a raw buffer. | |
| virtual int64_t | seek (int64_t offset, SeekMode mode=SeekAbsolute) throw (IOException) |
| Reposition the seek pointer in the stream. | |
| virtual int64_t | tell () throw (IOException) |
| Get the current (absolute) offset of the seek pointer. | |
| bool | isOpen () const throw () |
| Test if the stream is open. | |
| bool | isSeekable () const throw () |
| Test if the stream supports seeking. | |
| bool | isReadable () const throw () |
| Test if the stream can be read from. | |
| bool | isWritable () const throw () |
| Test if the stream can be written to. | |
| bool | isFullDuplex () const throw () |
| Test if the stream is full-duplex (i.e., supports both reading and writing). | |
| bool | isHalfDuplex () const throw () |
| Test if the stream is half-duplex (i.e., supports either reading or writing, but not both). | |
| timespan_ms_t | getTimeout () const throw () |
| Get the stream I/O timeout, in milliseconds. | |
| virtual void | init () throw (SocketException) |
| Initialize the socket. | |
| void | setReceiveBufSize (size_t size) throw (SocketException) |
| Set the size of the socket's internal receive buffer. | |
| size_t | getReceiveBufSize () const throw (SocketException) |
| Get the size of the socket's internal receive buffer. | |
| void | setSendBufSize (size_t size) throw (SocketException) |
| Set the size of the socket's internal send buffer. | |
| size_t | getSendBufSize () const throw (SocketException) |
| Get the size of the socket's internal send buffer. | |
| void | setLingerTime (timespan_s_t timeout) throw (SocketException) |
| Set the linger time for the socket. | |
| timespan_s_t | getLingerTime () const throw (SocketException) |
| Get the linger time for the socket. | |
| void | setReuseAddress (bool enable) throw (SocketException) |
| Enable or disable the SO_REUSEADDR option on the socket. | |
| bool | getReuseAddress () const throw (SocketException) |
| Determine if the SO_REUSEADDR option is enabled or disabled. | |
| void | setKeepAlive (bool enable) throw (SocketException) |
| Enable or disable the SO_KEEPALIVE option on the socket. | |
| bool | getKeepAlive () throw (SocketException) |
| Determine if the SO_KEEPALIVE option is enabled or disabled. | |
| void | setTCPDelay (bool enable) throw (SocketException) |
| Enable or disable the Nagle algorithm for send coalescing. | |
| bool | getTCPDelay () throw (SocketException) |
| Determine if the Nagle algorithm is enabled or disabled. | |
| bool | isInitialized () const throw () |
| Determine if the socket has been initialized. | |
| bool | isConnected () const throw () |
| Determine if the socket is connected. | |
| NetProtocol | getType () const throw () |
| Get the socket type. | |
| const SocketAddress & | getLocalAddress () const throw () |
| Get the address of the local end of the socket. | |
| const SocketAddress & | getRemoteAddress () const throw () |
| Get the address of the remote (peer) end of the socket. | |
Static Public Attributes | |
| static const uint_t | MAX_IOBLOCK_COUNT = 16 |
| The maximum number of I/O buffers that can be passed to the vector I/O methods. | |
Protected Types | |
| enum | IOWaitMode { WaitWrite, WaitRead } |
Protected Member Functions | |
| void | _init (FileHandle handle, bool seekable, bool readable, bool writable) |
| Initialize the stream for use with an open file. | |
| SocketHandle | getSocketHandle () const throw () |
| Get the underlying socket handle for this socket. | |
| void | waitForIO (IOWaitMode mode) throw (IOException) |
| Wait for the socket to become ready for reading or writing. | |
Protected Attributes | |
| NetProtocol | _type |
| The socket type. | |
| SocketHandle | _socket |
| A handle to the socket itself. | |
| SocketAddress | _raddr |
| The remote address. | |
| SocketAddress | _laddr |
| The local address. | |
| int | _sotimeout |
| The timeout value. | |
Friends | |
| class | ServerSocket |
A reliable, connection-oriented stream (TCP) socket.
enum IOWaitMode [protected, inherited] |
| StreamSocket | ( | uint16_t | port = 0 |
) | throw () |
Construct a new StreamSocket.
| port | The local port to bind to, or 0 to bind to an arbitrary port. |
| ~StreamSocket | ( | ) | throw () |
Destructor.
| void _init | ( | FileHandle | handle, | |
| bool | seekable, | |||
| bool | readable, | |||
| bool | writable | |||
| ) | [protected, inherited] |
Initialize the stream for use with an open file.
| handle | The handle to an open file. | |
| seekable | A flag indicating whether the stream is seekable. | |
| readable | A flag indicating whether the stream is readable. | |
| writable | A flag indicating whether the stream is writable. |
| void close | ( | IOMode | mode = IOReadWrite |
) | throw () [virtual] |
Close the stream for reading, writing, or both.
| mode | The close mode. |
Reimplemented from Stream.
| void connect | ( | const SocketAddress & | addr | ) | throw (IOException) [virtual] |
Connect the socket to a remote endpoint.
Note that if this call fails, the socket will revert to an uninitialized state; call init() again to reuse the socket.
| addr | The address. |
| IOException | If an error occurs. |
Reimplemented from Socket.
| void connect | ( | const String & | addr, | |
| uint16_t | port | |||
| ) | throw (IOException) [virtual] |
Connect the socket to a remote endpoint.
Note that if this call fails, the socket will revert to an uninitialized state; call init() again to reuse the socket.
| addr | The address, which may either be a dot-separated IP address or a DNS name. | |
| port | The port number. |
| IOException | If an error occurs. |
Reimplemented from Socket.
| bool getKeepAlive | ( | ) | throw (SocketException) [inherited] |
Determine if the SO_KEEPALIVE option is enabled or disabled.
| SocketException | If a socket error occurs. |
| timespan_s_t getLingerTime | ( | ) | const throw (SocketException) [inherited] |
Get the linger time for the socket.
| SocketException | If the linger time could not be retrieved. |
| const SocketAddress& getLocalAddress | ( | ) | const throw () [inline, inherited] |
Get the address of the local end of the socket.
| size_t getReceiveBufSize | ( | ) | const throw (SocketException) [inherited] |
Get the size of the socket's internal receive buffer.
| SocketException | If the size could not be changed. |
| const SocketAddress& getRemoteAddress | ( | ) | const throw () [inline, inherited] |
Get the address of the remote (peer) end of the socket.
| bool getReuseAddress | ( | ) | const throw (SocketException) [inherited] |
Determine if the SO_REUSEADDR option is enabled or disabled.
| SocketException | If a socket error occurs. |
| size_t getSendBufSize | ( | ) | const throw (SocketException) [inherited] |
Get the size of the socket's internal send buffer.
| SocketException | If the size could not be changed. |
| SocketHandle getSocketHandle | ( | ) | const throw () [inline, protected, inherited] |
Get the underlying socket handle for this socket.
| bool getTCPDelay | ( | ) | throw (SocketException) [inherited] |
Determine if the Nagle algorithm is enabled or disabled.
| SocketException | If a socket error occurs. |
| timespan_ms_t getTimeout | ( | ) | const throw () [inline, inherited] |
Get the stream I/O timeout, in milliseconds.
| NetProtocol getType | ( | ) | const throw () [inline, inherited] |
Get the socket type.
| void init | ( | ) | throw (SocketException) [virtual, inherited] |
Initialize the socket.
This method creates the underlying socket object.
| SocketException | If the socket could not be created. |
Reimplemented in ServerSocket.
| bool isConnected | ( | ) | const throw () [inline, inherited] |
Determine if the socket is connected.
| bool isFullDuplex | ( | ) | const throw () [inline, inherited] |
Test if the stream is full-duplex (i.e., supports both reading and writing).
| bool isHalfDuplex | ( | ) | const throw () [inline, inherited] |
Test if the stream is half-duplex (i.e., supports either reading or writing, but not both).
| bool isInitialized | ( | ) | const throw () [inline, inherited] |
Determine if the socket has been initialized.
| bool isOpen | ( | ) | const throw () [inline, inherited] |
Test if the stream is open.
| bool isReadable | ( | ) | const throw () [inline, inherited] |
Test if the stream can be read from.
| bool isSeekable | ( | ) | const throw () [inline, inherited] |
Test if the stream supports seeking.
| bool isWritable | ( | ) | const throw () [inline, inherited] |
Test if the stream can be written to.
| size_t read | ( | Buffer< T > & | buffer, | |
| size_t & | partial | |||
| ) | throw (IOException) [inline, inherited] |
Read data from the stream into a Buffer of arbitrary type.
If sizeof(T) is greater than 1 byte, then there can be no guarantee that the number of bytes read before a timeout or error occurs will be evenly divisible by sizeof(T). If the final element was partially read, the number of bytes of the element that were read will be stored in partial; this value should be passed unmodified to the next invocation of this method to continue reading from the appropriate offset within the partially-read element.
| buffer | The buffer to read into. | |
| partial | The number of bytes remaining to read for a partially-read element; on return, the number of bytes read of a partially-read element, or 0 if the last element was read completely. Should be set to 0 prior to the first call to this method for a fresh buffer. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
| size_t read | ( | MemoryBlock * | vec, | |
| uint_t | count | |||
| ) | throw (IOException) [virtual] |
Read data from the stream into a series of I/O buffers.
This operation is known as "vector read" or "scatter read." The buffers are read into in order. On systems that support it, the operation is performed with a single system call.
| vec | An array of buffers to read into. | |
| count | The number of buffers in the array. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
Reimplemented from Stream.
| size_t read | ( | ByteBuffer & | buffer, | |
| int64_t | offset, | |||
| AsyncIOTask & | task | |||
| ) | throw (IOException) [inline] |
Read data asynchronously from the stream into a Buffer.
| buffer | The Buffer to read into. This object must not be destroyed before the asynchronous I/O operation is completed or cancelled. | |
| offset | The file offset to read from. | |
| task | The async I/O control block for monitoring the operation. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t read | ( | byte_t * | buffer, | |
| size_t | buflen, | |||
| int64_t | offset, | |||
| AsyncIOTask & | task | |||
| ) | throw (IOException) [inline] |
Read data asynchronously from the stream into a raw buffer.
| buffer | The buffer to read into. | |
| buflen | The number of bytes to read. | |
| offset | The file offset to read from. | |
| task | The async I/O control block for monitoring the operation. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t read | ( | CharBuffer & | buffer | ) | throw (IOException) [inline, virtual] |
Read data from the stream into a CharBuffer.
| buffer | The buffer to read into. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
Reimplemented from Stream.
| size_t read | ( | ByteBuffer & | buffer | ) | throw (IOException) [inline, virtual] |
Read data from the stream into a ByteBuffer.
| buffer | The buffer to read into. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
Reimplemented from Stream.
| size_t read | ( | byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [virtual] |
Read data from the stream into a raw buffer.
| buffer | The buffer to read into. | |
| buflen | The number of bytes to read. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
Reimplemented from Stream.
| size_t readFully | ( | byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [virtual, inherited] |
Read data from the stream into a raw buffer, until either the buffer is full or an error or timeout occurs.
| buffer | The buffer to read into. | |
| buflen | The number of bytes to read. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
| size_t readFully | ( | Buffer< T > & | buffer, | |
| size_t & | partial | |||
| ) | throw (IOException) [inline, inherited] |
Read data from the stream into a Buffer of arbitrary type, until either the buffer is full or an error or timeout occurs.
If sizeof(T) is greater than 1 byte, then there can be no guarantee that the number of bytes read before a timeout or error occurs will be evenly divisible by sizeof(T). If the final element was partially read, the number of bytes of the element that were read will be stored in partial; this value should be passed unmodified to the next invocation of this method to continue reading from the appropriate offset within the partially-read element.
| buffer | The buffer to read into. | |
| partial | The number of bytes remaining to read for a partially-read element; on return, the number of bytes read of a partially-read element, or 0 if the last element was read completely. Should be set to 0 prior to the first call to this method for a fresh buffer. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
| size_t readFully | ( | CharBuffer & | buffer, | |
| size_t | count = 0 | |||
| ) | throw (IOException) [virtual, inherited] |
Read data from the stream into a CharBuffer, until either the buffer is full or an error or timeout occurs.
| buffer | The buffer to read into. | |
| count | The number of characters to read. If 0 or greater than the number of bytes between the position and the limit, reads up to the limit. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
| size_t readFully | ( | ByteBuffer & | buffer, | |
| size_t | count = 0 | |||
| ) | throw (IOException) [virtual, inherited] |
Read data from the stream into a ByteBuffer, until either the buffer is full or an error or timeout occurs.
| buffer | The buffer to read into. | |
| count | The number of bytes to read. If 0 or greater than the number of bytes between the position and the limit, reads up to the limit. |
| IOException | If the end-of-file was reached or some other I/O error occurred. |
| byte_t readOOB | ( | ) | throw (IOException) |
Read a byte of out-of-band data from the socket.
| IOException | If an I/O error occurs. |
| int64_t seek | ( | int64_t | offset, | |
| SeekMode | mode = SeekAbsolute | |||
| ) | throw (IOException) [virtual, inherited] |
Reposition the seek pointer in the stream.
| offset | The new offset. | |
| mode | The seek mode. |
| IOException | If the stream does not support seeking, or if some other I/O error occurred. |
| void setKeepAlive | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the SO_KEEPALIVE option on the socket.
| enable | true to enable the option false to disable it. |
| SocketException | If a socket error occurs. |
| void setLingerTime | ( | timespan_s_t | timeout | ) | throw (SocketException) [inherited] |
Set the linger time for the socket.
| timeout | The new linger time, in seconds; a negative value disables the linger feature. |
| SocketException | If the linger time could not be changed. |
| void setReceiveBufSize | ( | size_t | size | ) | throw (SocketException) [inherited] |
Set the size of the socket's internal receive buffer.
| size | The new size, in bytes. |
| SocketException | If the size could not be changed. |
| void setReuseAddress | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the SO_REUSEADDR option on the socket.
This method may only be called before the socket has been initialized. This option is off by default in newly created sockets.
| enable | true to enable the option false to disable it. |
| SocketException | If a socket error occurs, or if the call was made after the socket was initialized. |
| void setSendBufSize | ( | size_t | size | ) | throw (SocketException) [inherited] |
Set the size of the socket's internal send buffer.
| size | The new size, in bytes. |
| SocketException | If the size could not be changed. |
| void setTCPDelay | ( | bool | enable | ) | throw (SocketException) [inherited] |
Enable or disable the Nagle algorithm for send coalescing.
| enable | true to enable the Nagle algorithm (TCP_NODELAY off), false to disable it (TCP_NODELAY on). |
| SocketException | If a socket error occurs. |
| void setTimeout | ( | timespan_ms_t | timeout | ) | throw (IOException) |
Set the timeout for the socket.
The timeout affects both I/O and connections.
| timeout | The timeout, in milliseconds. |
| SocketException | If an error occurs. |
Reimplemented from Socket.
| void shutdown | ( | ) | throw () [virtual] |
Shut down the socket.
Closes the connection and destroys the underlying socket object.
Reimplemented from Socket.
| int64_t tell | ( | ) | throw (IOException) [virtual, inherited] |
Get the current (absolute) offset of the seek pointer.
| IOException | If the stream does not support seeking, or if some other I/O error occurred. |
| void waitForIO | ( | IOWaitMode | mode | ) | throw (IOException) [protected, inherited] |
Wait for the socket to become ready for reading or writing.
| mode | The wait mode; one of WaitWrite or WaitRead. |
| IOException | On timeout or other error. |
| size_t write | ( | Buffer< T > & | buffer, | |
| size_t & | partial | |||
| ) | throw (IOException) [inline, inherited] |
Write data to the stream from a Buffer of arbitrary type.
If sizeof(T) is greater than 1 byte, then there can be no guarantee that the number of bytes written before a timeout or error occurs will be evenly divisible by sizeof(T). If the final element was partially written, the number of bytes of the element that were written will be stored in partial; this value should be passed unmodified to the next invocation of this method to continue writing from the appropriate offset within the partially-written element.
| buffer | The buffer to write. | |
| partial | The number of bytes remaining to write for a partially-written element; on return, the number of bytes written of a partially-written element, or 0 if the last element was written completely. Should be set to 0 prior to the first call to this method for a fresh buffer. |
| IOException | If an I/O error occurred. |
| size_t write | ( | const MemoryBlock * | vec, | |
| uint_t | count | |||
| ) | throw (IOException) [virtual] |
Write data to the stream from a series of I/O buffers.
This operation is known as "vector write" or "gather write." The buffers are written in order. On systems that support it, the operation is performed with a single system call.
| vec | An array of buffers to write. | |
| count | The number of buffers in the array. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t write | ( | ByteBuffer & | buffer, | |
| int64_t | offset, | |||
| AsyncIOTask & | task | |||
| ) | throw (IOException) [inline] |
Write data asynchronously to the stream from a Buffer.
| buffer | The Buffer to write. This object must not be destroyed before the asynchronous I/O operation is completed or cancelled. | |
| offset | The file offset to write to. | |
| task | The async I/O control block for monitoring the operation. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t write | ( | const byte_t * | buffer, | |
| size_t | buflen, | |||
| int64_t | offset, | |||
| AsyncIOTask & | task | |||
| ) | throw (IOException) [inline] |
Write data asynchronously to the stream from a raw buffer.
| buffer | The buffer to write. | |
| buflen | The number of bytes to write. | |
| offset | The file offset to write to. | |
| task | The async I/O control block for monitoring the operation. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t write | ( | CharBuffer & | buffer | ) | throw (IOException) [inline, virtual] |
Write data to the stream from a CharBuffer.
| buffer | The buffer to write. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t write | ( | ByteBuffer & | buffer | ) | throw (IOException) [inline, virtual] |
Write data to the stream from a ByteBuffer.
| buffer | The buffer to write. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t write | ( | const byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [virtual] |
Write data to the stream from a raw buffer, until either the entire buffer is written or an error or timeout occurs.
| buffer | A pointer to the buffer. | |
| buflen | The number of bytes to write. |
| IOException | If an I/O error occurred. |
Reimplemented from Stream.
| size_t writeFully | ( | const byte_t * | buffer, | |
| size_t | buflen | |||
| ) | throw (IOException) [virtual, inherited] |
Write data to the stream from a raw buffer.
| buffer | A pointer to the buffer. | |
| buflen | The number of bytes to write. |
| IOException | If an I/O error occurred. |
| size_t writeFully | ( | Buffer< T > & | buffer, | |
| size_t & | partial | |||
| ) | throw (IOException) [inline, inherited] |
Write data to the stream from a Buffer of arbitrary type, until either the entire buffer is written or an error or timeout occurs.
If sizeof(T) is greater than 1 byte, then there can be no guarantee that the number of bytes written before a timeout or error occurs will be evenly divisible by sizeof(T). If the final element was partially written, the number of bytes of the element that were written will be stored in partial; this value should be passed unmodified to the next invocation of this method to continue writing from the appropriate offset within the partially-written element.
| buffer | The buffer to write. | |
| partial | The number of bytes remaining to write for a partially-written element; on return, the number of bytes written of a partially-written element, or 0 if the last element was written completely. Should be set to 0 prior to the first call to this method for a fresh buffer. |
| IOException | If an I/O error occurred. |
| size_t writeFully | ( | CharBuffer & | buffer | ) | throw (IOException) [virtual, inherited] |
Write data to the stream from a CharBuffer, until either the entire buffer is written or an error or timeout occurs.
| buffer | The buffer to write. |
| IOException | If an I/O error occurred. |
| size_t writeFully | ( | ByteBuffer & | buffer | ) | throw (IOException) [virtual, inherited] |
Write data to the stream from a ByteBuffer, until either the entire buffer is written or an error or timeout occurs.
| buffer | The buffer to write. |
| IOException | If and I/O error occurred. |
| void writeOOB | ( | byte_t | data | ) | throw (IOException) |
Write a byte of out-of-band data to the socket.
| data | The byte of OOB data to write. |
| IOException | If an I/O error occurs. |
friend class ServerSocket [friend] |
Reimplemented from Socket.
SocketAddress _laddr [protected, inherited] |
The local address.
SocketAddress _raddr [protected, inherited] |
The remote address.
SocketHandle _socket [protected, inherited] |
A handle to the socket itself.
int _sotimeout [protected, inherited] |
The timeout value.
NetProtocol _type [protected, inherited] |
The socket type.
const uint_t MAX_IOBLOCK_COUNT = 16 [static, inherited] |
The maximum number of I/O buffers that can be passed to the vector I/O methods.
1.6.3