X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fsocket_handler.hxx;h=b9aa175ddaaa9a7bf3e475cf999e10bd3229f247;hp=32fbbf4d2f6df51c1717fbf016450fed3592829a;hb=517d1214577af263bb4d6821e4e7ad9ba8c94901;hpb=a7170401dd90dc79cc7d7a808cfe18a06c7e983b diff --git a/src/socket_handler.hxx b/src/socket_handler.hxx index 32fbbf4..b9aa175 100644 --- a/src/socket_handler.hxx +++ b/src/socket_handler.hxx @@ -32,18 +32,19 @@ namespace libt2n class socket_handler { private: - static const unsigned int recv_buffer_size=2048; - static const unsigned int write_block_size=4096; + static const unsigned int default_recv_buffer_size=2048; + static const unsigned int default_write_block_size=4096; socket_type_value socket_type; - bool data_waiting(long long usec_timeout=-1); + bool data_waiting(long long usec_timeout,long long *timeout_remaining=NULL); protected: int sock; + unsigned int recv_buffer_size; + unsigned int write_block_size; - socket_handler(int _sock, socket_type_value _socket_type) - { sock=_sock; socket_type=_socket_type; } + socket_handler(int _sock, socket_type_value _socket_type); void set_socket_options(int sock); @@ -54,15 +55,21 @@ class socket_handler virtual void close(); - bool fill_buffer(std::string& buffer, long long usec_timeout); + bool fill_buffer(std::string& buffer, long long usec_timeout, long long*timeout_remaining=NULL); bool fill_buffer(std::string& buffer); public: - /// is this a tcp or udp socket connection + /// is this a tcp or unix socket connection socket_type_value get_type() { return socket_type; } bool is_closed(); + + void set_recv_buffer_size(unsigned int new_recv_buffer_size); + void set_write_block_size(unsigned int new_write_block_size); + + unsigned int get_recv_buffer_size() const { return recv_buffer_size; } + unsigned int get_write_block_size() const { return write_block_size; } }; }