Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_BufferedSocket

Non-blocked, buffered socket transmission interface.
Contained in: global
Derived from: CL_Socket
Derived by: none
Group: Network (Sockets)

#include <ClanLib/network.h>

### public function member index:

### Construction:

`` | `CL_BufferedSocket` | `(`int` `socket`)`;
`` | `CL_BufferedSocket` | `(`Type` `type`)`;
`` | `CL_BufferedSocket` | `(`const` `CL_Socket`& `socket`)`;
`` | `CL_BufferedSocket` | `(`const` `CL_BufferedSocket`& `copy`)`;
``virtual`` | `~CL_BufferedSocket` | `()`;

### Attributes:

``int`` | `get_input_buffer_size` | `() `const``;

### Operations:

``void`` | `set_input_buffer_size` | `(`int` `size`)`;

## Description:

The buffered socket class works like a socket in non-blocking mode, with a few exceptions:
any write operation will always write the full data. Any data not immidiately writeable to the socket will be buffered and written in a seperate thread as the socket can receive them. When all the data has been written, the write event will trigger.
incoming data is also buffered. Each time the input buffer has been filled (which can be changed with set_input_buffer_size(int size), the read event will trigger.
Using this class, you can easilly write and read data in the chunk sizes you prefer.

## Function Member Descriptions:

CL_BufferedSocket::CL_BufferedSocket - Constructs an attached socket.
`` `CL_BufferedSocket` `(`int` `socket`)`;

CL_BufferedSocket::CL_BufferedSocket - Constructs a new socket using the specified protocol type.
`` `CL_BufferedSocket` `(`Type` `type`)`;

CL_BufferedSocket::CL_BufferedSocket - Create socket that is attached to the passed socket.
Note that since the buffered socket class will read data from the socket (buffering it), it will no longer be safe to use the original socket until the buffered socket instance has been destroyed.
`` `CL_BufferedSocket` `(`const` `CL_Socket`& `socket`)`;

CL_BufferedSocket::CL_BufferedSocket - Copy constructor.
`` `CL_BufferedSocket` `(`const` `CL_BufferedSocket`& `copy`)`;

CL_BufferedSocket::get_input_buffer_size - Returns the size of the buffered input buffer. Each time it is full, the read event will trigger.
``int`` `get_input_buffer_size` `() `const``;

CL_BufferedSocket::set_input_buffer_size - Sets the size of the buffered input buffer. Each time it is full, the read event will trigger.
``void`` `set_input_buffer_size` `(`int` `size`)`;

CL_BufferedSocket::~CL_BufferedSocket - Buffered Socket Destructor
``virtual`` `~CL_BufferedSocket` `()`;

## Variable Member Descriptions: