Claw
1.7.3
|
Socket buffer to be used with std::basic_stream, for easy socket reading and writing. More...
#include <basic_socketbuf.hpp>
Public Types | |
typedef CharT | char_type |
The type of the characters in the stream. | |
typedef Traits | traits_type |
The traits carry some informations about the char_type. | |
typedef traits_type::int_type | int_type |
The type used to represent integers. | |
typedef traits_type::pos_type | pos_type |
The type used to represent a position in the stream. | |
typedef traits_type::off_type | off_type |
The type used to represent a delta in the positions. | |
typedef basic_socketbuf < char_type, traits_type > | self_type |
The type of this implementation. |
Public Member Functions | |
basic_socketbuf (int read_limit=-1) | |
Constructor. | |
virtual | ~basic_socketbuf () |
Destructor. | |
self_type * | open (const std::string &addr, int port) |
Initialise the socket. | |
self_type * | open (socket_traits::descriptor d) |
Link the socket to a file descriptor. | |
self_type * | close () |
Close the socket. | |
bool | is_open () const |
Tell if the socket is open. | |
void | set_read_time_limit (int read_limit) |
Set the number of second to wait before considering nothing will come in the socket. |
Protected Member Functions | |
virtual int | sync () |
Write the buffered data in the socket. | |
virtual int_type | underflow () |
Fill the input buffer. | |
virtual int_type | overflow (int_type c=traits_type::eof()) |
Synchronize the output buffer (ie. write in the socket). |
Additional Inherited Members | |
Private Member Functions inherited from claw::net::basic_socket | |
basic_socket () | |
Constructor. | |
basic_socket * | open () |
Open the socket. | |
basic_socket * | close () |
Close the socket. | |
bool | is_open () const |
Tell if the socket is open. |
Socket buffer to be used with std::basic_stream, for easy socket reading and writing.
Definition at line 48 of file basic_socketbuf.hpp.
claw::net::basic_socketbuf< CharT, Traits >::basic_socketbuf | ( | int | read_limit = -1 | ) |
Constructor.
read_limit | Number of second to wait before considering nothing will come in the socket. Negative values mean infinity. |
Definition at line 44 of file basic_socketbuf.tpp.
claw::net::basic_socketbuf< CharT, Traits >::self_type * claw::net::basic_socketbuf< CharT, Traits >::close | ( | ) |
Close the socket.
Definition at line 130 of file basic_socketbuf.tpp.
References claw::net::basic_socket::close().
claw::net::basic_socketbuf< CharT, Traits >::self_type * claw::net::basic_socketbuf< CharT, Traits >::open | ( | const std::string & | address, |
int | port | ||
) |
Initialise the socket.
address | Address to open. |
port | The port to connect to. |
Definition at line 72 of file basic_socketbuf.tpp.
References claw::net::basic_socket::open().
claw::net::basic_socketbuf< CharT, Traits >::self_type * claw::net::basic_socketbuf< CharT, Traits >::open | ( | socket_traits::descriptor | d | ) |
Link the socket to a file descriptor.
d | The file descriptor. |
Definition at line 99 of file basic_socketbuf.tpp.
References claw::socket_traits_unix::is_open().
|
protectedvirtual |
Synchronize the output buffer (ie. write in the socket).
c |
Definition at line 234 of file basic_socketbuf.tpp.
References CLAW_PRECOND.
void claw::net::basic_socketbuf< CharT, Traits >::set_read_time_limit | ( | int | read_limit | ) |
Set the number of second to wait before considering nothing will come in the socket.
read_limit | The number of seconds. Negative values mean infinity. |
Definition at line 156 of file basic_socketbuf.tpp.
|
protectedvirtual |
Write the buffered data in the socket.
Definition at line 167 of file basic_socketbuf.tpp.
References CLAW_PRECOND.
|
protectedvirtual |
Fill the input buffer.
Definition at line 197 of file basic_socketbuf.tpp.
References CLAW_PRECOND, and claw::socket_traits_unix::select_read().