8#ifndef FACEBOOK_NETWORK_CONNECTION_ORIENTED_CLIENT_H 
    9#define FACEBOOK_NETWORK_CONNECTION_ORIENTED_CLIENT_H 
   59        virtual bool connect(
const unsigned int timeout = 1000u);
 
   93        inline Address4 receiverAddress() 
const;
 
   99        inline Port receiverPort() 
const;
 
  137        virtual size_t onSend(
const void* data, 
const size_t size);
 
  144        virtual void onReceived(
const void* data, 
const size_t size);
 
  161        bool isConnected_ = 
false;
 
 
  166    ocean_assert(strlen(message.c_str()) == message.length() && message.c_str()[message.length()] == 
'\0');
 
  167    return send(message.c_str(), message.length() + 1);
 
 
This class wraps an address number with 32 bits.
Definition Address4.h:26
 
This class is the base class for all clients.
Definition Client.h:25
 
This class is the base class for all connection oriented clients.
Definition ConnectionOrientedClient.h:28
 
virtual SocketResult send(const void *data, const size_t size)
Sends data via the established connection.
 
Address4 receiverAddress() const
Returns the (remote) receiver address.
Definition ConnectionOrientedClient.h:170
 
~ConnectionOrientedClient() override
Destructs a connection oriented client.
 
Port receiverPort_
Receiver port.
Definition ConnectionOrientedClient.h:152
 
ConnectionOrientedClient()
Creates a new connection oriented client.
 
Port receiverPort() const
Returns the (remote) receiver port.
Definition ConnectionOrientedClient.h:176
 
bool onScheduler() override
The scheduler event function.
 
virtual bool isConnected() const
Returns whether this client is connected.
 
virtual bool disconnect()
Disconnects the client.
 
virtual void onReceived(const void *data, const size_t size)
Internal event function for received data.
 
Address4 receiverAddress_
Receiver address.
Definition ConnectionOrientedClient.h:149
 
virtual bool connect(const unsigned int timeout=1000u)
Reconnects the client by the usage of the most recent address and port.
 
DisconnectCallback disconnectCallback_
Disconnect callback function.
Definition ConnectionOrientedClient.h:158
 
ReceiveCallback receiveCallback_
Receive callback function.
Definition ConnectionOrientedClient.h:155
 
void setDisconnectCallback(const DisconnectCallback &callback)
Sets the disconnect callback function.
Definition ConnectionOrientedClient.h:188
 
void setReceiveCallback(const ReceiveCallback &callback)
Sets the receive callback function.
Definition ConnectionOrientedClient.h:182
 
virtual size_t onSend(const void *data, const size_t size)
Internal event function to send data.
 
virtual bool connect(const Address4 &address, const Port &port, const unsigned int timeout=1000u)
Connects to a connection-oriented server.
 
This class wraps a port number with 16 bits.
Definition Port.h:26
 
SocketResult
Definition of individual result values.
Definition Socket.h:62
 
Lock lock_
Socket lock.
Definition Socket.h:187
 
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
 
The namespace covering the entire Ocean framework.
Definition Accessor.h:15