#include <tcp_socket.h>
Definition at line 15 of file tcp_socket.h.
◆ EEvent
| Enumerator |
|---|
| InputReady | |
| OutputReady | |
| HangUp | |
| ErrorCondition | |
| InvalidRequest | |
Definition at line 19 of file tcp_socket.h.
◆ CTCPSocket() [1/3]
| argos::CTCPSocket::CTCPSocket |
( |
int | n_stream = -1 | ) |
|
◆ CTCPSocket() [2/3]
| argos::CTCPSocket::CTCPSocket |
( |
const CTCPSocket & | c_other | ) |
|
|
delete |
◆ CTCPSocket() [3/3]
| argos::CTCPSocket::CTCPSocket |
( |
CTCPSocket && | c_other | ) |
|
◆ ~CTCPSocket()
| argos::CTCPSocket::~CTCPSocket |
( |
| ) |
|
◆ Accept()
| void argos::CTCPSocket::Accept |
( |
CTCPSocket & | c_socket | ) |
|
Accept a connection from a client.
Internally, the connection is forced to be only IPv4. Before calling this function, you must first call Listen() to setup connection listening.
- Parameters
-
| c_socket | The socket on which the connection has been created |
- Exceptions
-
- See also
- Listen
-
Connect
Definition at line 149 of file tcp_socket.cpp.
◆ Connect()
| void argos::CTCPSocket::Connect |
( |
const std::string & | str_hostname, |
|
|
SInt32 | n_port ) |
Connects this socket to the specified hostname and port.
Internally, the connection is forced to be only IPv4.
- Parameters
-
| str_hostname | The wanted hostname |
| n_port | The wanted port |
- Exceptions
-
- See also
- Accept
Definition at line 61 of file tcp_socket.cpp.
◆ Disconnect()
| void argos::CTCPSocket::Disconnect |
( |
| ) |
|
◆ GetAddress()
| const std::string & argos::CTCPSocket::GetAddress |
( |
| ) |
const |
|
inline |
Returns a string containing the IPv4 address in dot notation.
- Returns
- A string containing the IPv4 address in dot notation.
Definition at line 69 of file tcp_socket.h.
◆ GetEvents()
Check the socket for events.
- Returns
- an ordered set of events
Definition at line 173 of file tcp_socket.cpp.
◆ GetStream()
| int argos::CTCPSocket::GetStream |
( |
| ) |
const |
|
inline |
Returns the socket stream.
- Returns
- the socket stream.
Definition at line 61 of file tcp_socket.h.
◆ IsConnected()
| bool argos::CTCPSocket::IsConnected |
( |
| ) |
const |
|
inline |
Returns true if the socket is connected.
- Returns
true if the socket is connected.
Definition at line 53 of file tcp_socket.h.
◆ Listen()
| void argos::CTCPSocket::Listen |
( |
SInt32 | n_port, |
|
|
SInt32 | n_queue_length = 10 ) |
Listens for connections on the specified local port.
Internally, the connection is forced to be only IPv4. To actually accept connections, you must call Accept() after calling this function.
- Parameters
-
| n_port | The wanted port |
| n_queue_length | The maximum length of the queue of pending connections (also called the backlog) |
- Exceptions
-
- See also
- Accept
Definition at line 101 of file tcp_socket.cpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator==()
| bool argos::CTCPSocket::operator== |
( |
const CTCPSocket & | c_other | ) |
const |
|
inline |
Returns true if the two sockets refer to same file descriptor.
- Returns
true if the two sockets refer to same file descriptor.
Definition at line 45 of file tcp_socket.h.
◆ ReceiveBuffer()
| bool argos::CTCPSocket::ReceiveBuffer |
( |
UInt8 * | pun_buffer, |
|
|
size_t | un_size ) |
Fills the passed buffer with the data received through the socket.
- Parameters
-
| pun_buffer | The buffer to fill |
| un_size | The size of the buffer |
- Returns
true if the buffer was filled correctly; false if the connection was closed by the other peer
- Exceptions
-
Definition at line 212 of file tcp_socket.cpp.
◆ ReceiveByteArray()
| bool argos::CTCPSocket::ReceiveByteArray |
( |
CByteArray & | c_byte_array | ) |
|
Receives the passed byte array through the socket.
Internally, this function first receives the size of the byte array as a long int, and then receives the content of the byte array. It is meant to the be used in conjunction with SendByteArray().
- Parameters
-
| c_byte_array | The byte array |
- Returns
true if the buffer was filled correctly; false if the connection was closed by the other peer
- Exceptions
-
- See also
- CByteArray
-
ReceiveBuffer
-
SendByteArray
Definition at line 242 of file tcp_socket.cpp.
◆ RecvMsg()
| void argos::CTCPSocket::RecvMsg |
( |
CByteArray & | c_payload | ) |
|
◆ SendBuffer()
| void argos::CTCPSocket::SendBuffer |
( |
const UInt8 * | pun_buffer, |
|
|
size_t | un_size ) |
Sends the passed buffer through the socket.
- Parameters
-
| pun_buffer | The wanted buffer |
| un_size | The size of the buffer |
- Exceptions
-
Definition at line 195 of file tcp_socket.cpp.
◆ SendByteArray()
| void argos::CTCPSocket::SendByteArray |
( |
const CByteArray & | c_byte_array | ) |
|
Sends the passed byte array through the socket.
Internally, this function first sends the size of the byte array as a long int, and then sends the content of the byte array. It is meant to the be used in conjunction with ReceiveByteArray().
- Parameters
-
| c_byte_array | The byte array |
- Exceptions
-
- See also
- CByteArray
-
SendBuffer
-
ReceiveByteArray
Definition at line 231 of file tcp_socket.cpp.
◆ SendMsg()
| void argos::CTCPSocket::SendMsg |
( |
const CByteArray & | c_payload, |
|
|
bool | b_more = false ) |
The documentation for this class was generated from the following files: