8 #include <argos3/core/utility/datatypes/byte_array.h>
9 #include <argos3/core/utility/datatypes/datatypes.h>
11 #include <unordered_set>
46 return m_nStream == c_other.m_nStream;
54 return m_nStream != -1;
81 void Connect(
const std::string& str_hostname,
94 SInt32 n_queue_length = 10);
179 std::string m_strAddress;
192 template<>
struct hash<
argos::CTCPSocket::EEvent> {
194 return static_cast<size_t>(e_event);
signed int SInt32
32-bit signed integer.
unsigned int UInt32
32-bit unsigned integer.
unsigned char UInt8
8-bit unsigned integer.
The namespace containing all the ARGoS related code.
Byte array utility class.
void Accept(CTCPSocket &c_socket)
Accept a connection from a client.
void SendByteArray(const CByteArray &c_byte_array)
Sends the passed byte array through the socket.
CTCPSocket & operator=(const CTCPSocket &c_other)=delete
int GetStream() const
Returns the socket stream.
bool ReceiveByteArray(CByteArray &c_byte_array)
Receives the passed byte array through the socket.
CTCPSocket(int n_stream=-1)
bool operator==(const CTCPSocket &c_other) const
Returns true if the two sockets refer to same file descriptor.
void Disconnect()
Close the socket.
void SendMsg(const CByteArray &c_payload, bool b_more=false)
void RecvMsg(CByteArray &c_payload)
void Listen(SInt32 n_port, SInt32 n_queue_length=10)
Listens for connections on the specified local port.
void SendBuffer(const UInt8 *pun_buffer, size_t un_size)
Sends the passed buffer through the socket.
const std::string & GetAddress() const
Returns a string containing the IPv4 address in dot notation.
std::unordered_set< EEvent > GetEvents()
Check the socket for events.
bool ReceiveBuffer(UInt8 *pun_buffer, size_t un_size)
Fills the passed buffer with the data received through the socket.
CTCPSocket(const CTCPSocket &c_other)=delete
void Connect(const std::string &str_hostname, SInt32 n_port)
Connects this socket to the specified hostname and port.
bool IsConnected() const
Returns true if the socket is connected.
size_t operator()(const argos::CTCPSocket::EEvent &e_event) const