13 #ifndef CONNECTEDSOCKET_H
14 #define CONNECTEDSOCKET_H
49 virtual void Listen(
const unsigned int port,
50 const std::string localAddress =
"ANY") = 0;
69 virtual bool Connect(
const unsigned int port,
70 const std::string distantAddress,
Time timeout) = 0;
79 virtual ssize_t
SendMessage(
const char *message,
size_t message_len,
93 virtual ssize_t
RecvMessage(
char *buf,
size_t buf_len,
Time timeout) = 0;
95 std::string ReadString(
const size_t &stringLength,
Time timeout);
96 uint16_t ReadUInt16(
Time const &timeout);
97 void WriteUInt16(uint16_t
const &data,
Time const &timeout);
98 uint32_t ReadUInt32(
Time const &timeout);
99 void WriteUInt32(uint32_t
const &data,
Time const &timeout);
104 virtual uint16_t HostToNetwork16(uint16_t data) = 0;
105 virtual uint32_t NetworkToHost32(uint32_t data) = 0;
106 virtual uint32_t HostToNetwork32(uint32_t data) = 0;
112 #endif // CONNECTEDSOCKET_H
Interface class encapsulating a connected socket. Preserves packets order and guaranty delivery...
Definition: ConnectedSocket.h:27
virtual void Listen(const unsigned int port, const std::string localAddress="ANY")=0
Returns a socket which listens on a specific port/address.
virtual ssize_t SendMessage(const char *message, size_t message_len, Time timeout)=0
Send a message waiting up to timeout ns.
Base class for all Framework's classes.
Definition: Object.h:83
namespace of the flair Framework
Definition: Ahrs.h:19
unsigned long long Time
Time definition, in ns.
Definition: Object.h:55
~ConnectedSocket()
Destructor.
ConnectedSocket(const Object *parent, const std::string name)
Constructor.
virtual bool Connect(const unsigned int port, const std::string distantAddress, Time timeout)=0
Returns a socket connected to a distant host.
Base class for all Framework's classes.
virtual ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout)=0
Receive a message.
virtual uint16_t NetworkToHost16(uint16_t data)=0
! See Socket.h for a more generic implementation of network/host endianness
virtual ConnectedSocket * Accept(Time timeout)=0
Returns a socket on a new incoming connexion.