PIP 5.6.1
Platform-Independent Primitives
Public Member Functions | Protected Member Functions | List of all members
PIClientServer::ClientBase Class Reference

Base class for client and server-side client communication. Provides TCP connection management, diagnostics, and packet streaming capabilities. More...

#include <piclientserver_client_base.h>

Inheritance diagram for PIClientServer::ClientBase:
Inheritance graph
[legend]

Public Member Functions

 ClientBase ()
 Constructs a disconnected client connection object.
 
virtual ~ClientBase ()
 Destroys the client connection and releases owned resources.
 
const PIEthernetgetTCP () const
 Returns the underlying TCP transport object.
 
void close ()
 Closes the connection immediately.
 
void stopAndWait ()
 Stops the connection workflow and waits until shutdown completes.
 
int write (const void *d, const size_t s)
 Sends raw payload bytes through the stream packer.
 
int write (const PIByteArray &ba)
 Sends payload stored in "ba".
 
void enableDiagnostics ()
 Enables connection diagnostics collection.
 
PIDiagnostics::State diagnostics () const
 Returns a snapshot of current diagnostics counters.
 
int receivePacketProgress () const
 Returns how many payload bytes of the current packet are already received (all bytes count passed in receivePacketStart()).
 
const PIStreamPackerConfigconfiguration () const
 Returns the current packet framing configuration.
 
PIStreamPackerConfigconfiguration ()
 Returns the current packet framing configuration for modification.
 
void setConfiguration (const PIStreamPackerConfig &config)
 Replaces the packet framing configuration.
 

Protected Member Functions

virtual void readed (PIByteArray data)
 Called when a full payload packet is received.
 
virtual void connected ()
 Called after the TCP connection becomes active.
 
virtual void disconnected ()
 Called after the connection is closed.
 
virtual void receivePacketStart (int size)
 Called when reception of a new packet starts.
 
virtual void receivePacketEnd ()
 Called when reception of the current packet finishes.
 

Detailed Description

Base class for client and server-side client communication. Provides TCP connection management, diagnostics, and packet streaming capabilities.