Menu

[94f52a]: / poll / buffered_socket_client.hpp  Maximize  Restore  History

Download this file

35 lines (25 with data), 898 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef CHILON_POLL_BUFFERED_SOCKET_CLIENT_HPP
#define CHILON_POLL_BUFFERED_SOCKET_CLIENT_HPP
#include <chilon/poll/socket_client.hpp>
#ifndef CHILON_DEFAULT_BUFF_SIZE
#define CHILON_DEFAULT_BUFF_SIZE 4096
#endif
namespace chilon { namespace poll {
/**
* @brief buffered_socket_client represents a socket and provides read and write buffers
* for it to use.
*/
template <class Client, int READ_BUFF_SIZE = CHILON_DEFAULT_BUFF_SIZE, int SEND_BUFF_SIZE = READ_BUFF_SIZE>
struct buffered_socket_client : public socket_client<Client> {
buffered_socket_client()
: end_idx_(0), read_idx_(0), write_idx_(0) {}
buffered_socket_client(int const socket)
: socket_client<Client>(socket), end_idx_(0), read_idx_(0), write_idx_(0) {}
int end_idx_;
int read_idx_;
char read_[READ_BUFF_SIZE];
char write_[SEND_BUFF_SIZE];
off_t write_idx_;
};
} }
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.