ClickHouse/src/IO/WriteBufferFromPocoSocket.h

34 lines
797 B
C++
Raw Normal View History

2012-03-09 15:46:52 +00:00
#pragma once
#include <Poco/Net/Socket.h>
#include <IO/WriteBuffer.h>
#include <IO/BufferWithOwnMemory.h>
2012-03-09 15:46:52 +00:00
namespace DB
{
2017-05-28 14:29:40 +00:00
/** Works with the ready Poco::Net::Socket. Blocking operations.
2012-03-09 15:46:52 +00:00
*/
class WriteBufferFromPocoSocket : public BufferWithOwnMemory<WriteBuffer>
{
2021-11-10 22:58:56 +00:00
public:
explicit WriteBufferFromPocoSocket(Poco::Net::Socket & socket_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE);
2021-11-10 22:58:56 +00:00
~WriteBufferFromPocoSocket() override;
2012-03-09 15:46:52 +00:00
protected:
2021-11-10 22:58:56 +00:00
void nextImpl() override;
Poco::Net::Socket & socket;
2017-05-28 14:29:40 +00:00
/** For error messages. It is necessary to receive this address in advance, because,
* for example, if the connection is broken, the address will not be received anymore
* (getpeername will return an error).
*/
Poco::Net::SocketAddress peer_address;
2012-03-09 15:46:52 +00:00
};
}