21 #ifndef G_NET_CLIENT__H
22 #define G_NET_CLIENT__H
51 explicit Client(
const Location & remote_info ,
unsigned int connection_timeout = 0U ,
52 unsigned int response_timeout = 0U ,
unsigned int secure_connection_timeout = 0U ,
81 virtual bool onReceive(
const char * line_data ,
size_t line_size ,
size_t eol_size ) = 0 ;
98 virtual void onDeleteImp(
const std::string & reason )
override ;
104 virtual void onData(
const char * , SimpleClient::size_type )
override ;
115 void operator=(
const Client& ) ;
116 void onConnectionTimeout() ;
117 void onResponseTimeout() ;
124 unsigned int m_connection_timeout ;
125 unsigned int m_response_timeout ;
std::string lineBufferEndOfLine() const
Returns the line buffer end-of-line string.
G::Slot::Signal0 & connectedSignal()
Returns a signal that indicates that the client has successfully connected to the server...
virtual void onConnecting() override
Override from GNet::HeapClient.
virtual bool onReceive(const char *line_data, size_t line_size, size_t eol_size)=0
Called when a complete line is received from the peer.
virtual void onDeleteImp(const std::string &reason) override
Override from GNet::HeapClient.
virtual void onConnectImp() override
Override from GNet::SimpleClient.
The GNet::Address class encapsulates a TCP/UDP transport address.
G::Slot::Signal2< std::string, std::string > & eventSignal()
Returns a signal that indicates that something interesting has happened.
virtual ~Client()
Destructor.
A class that holds a host/service name pair and the preferred address family (if any), and also the results of a name-to-address lookup, ie.
static Address defaultAddress()
Returns a default address, being the IPv4 wildcard address with a zero port number.
A configuration structure for GNet::LineBuffer.
void clearInput()
Clears the line buffer.
A SimpleClient class for client objects that manage their own lifetime on the heap.
G::Slot::Signal1< std::string > & doneSignal()
Returns a signal that indicates that client processing is complete.
A signal class for zero-parameter callbacks.
static bool synchronousDnsDefault()
Returns true if DNS queries should normally be synchronous on this platform.
A class that does line buffering, supporting auto-detection of line endings and fixed-size extraction...
A timer class template in which the timeout is delivered to the specified method. ...
virtual void onSendImp() override
Override from GNet::SimpleClient.
Client(const Location &remote_info, unsigned int connection_timeout=0U, unsigned int response_timeout=0U, unsigned int secure_connection_timeout=0U, LineBufferConfig=LineBufferConfig(), bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), bool sync_dns=synchronousDnsDefault())
Constructor. The connection is initiated asynchronously.
A HeapClient class that adds slot/signal signalling, connection/response timeouts, and input line buffering.
virtual void onData(const char *, SimpleClient::size_type) override
Override from GNet::SocketProtocolSink.