Class for TCP socket abstraction.
More...
#include <tcp_socket.h>
|
virtual bool | open (int socket_fd, struct sockaddr *address, size_t address_len) |
|
virtual void | setOptions (int socket_fd) |
|
bool | setup (std::string &host, int port) |
|
Class for TCP socket abstraction.
Definition at line 48 of file tcp_socket.h.
urcl::comm::TCPSocket::TCPSocket |
( |
| ) |
|
urcl::comm::TCPSocket::~TCPSocket |
( |
| ) |
|
|
virtual |
void urcl::comm::TCPSocket::close |
( |
| ) |
|
std::string urcl::comm::TCPSocket::getIP |
( |
| ) |
const |
Determines the local IP address of the currently configured socket.
- Returns
- The local IP address of the socket associated to the current file descriptor
Definition at line 120 of file tcp_socket.cpp.
int urcl::comm::TCPSocket::getSocketFD |
( |
| ) |
|
|
inline |
Getter for the file descriptor of the socket.
- Returns
- The file descriptor of the socket
Definition at line 87 of file tcp_socket.h.
Getter for the state of the socket.
- Returns
- Returns the current state of the socket
Definition at line 77 of file tcp_socket.h.
virtual bool urcl::comm::TCPSocket::open |
( |
int |
socket_fd, |
|
|
struct sockaddr * |
address, |
|
|
size_t |
address_len |
|
) |
| |
|
inlineprotectedvirtual |
bool urcl::comm::TCPSocket::read |
( |
char * |
character | ) |
|
Reads one byte from the socket.
- Parameters
-
[out] | character | Target buffer |
- Returns
- True on success, false otherwise
Definition at line 137 of file tcp_socket.cpp.
bool urcl::comm::TCPSocket::read |
( |
uint8_t * |
buf, |
|
|
const size_t |
buf_len, |
|
|
size_t & |
read |
|
) |
| |
Reads data from the socket.
- Parameters
-
[out] | buf | Buffer where the data shall be stored |
[in] | buf_len | Number of bytes allocated for the buffer |
[out] | read | Number of bytes actually read |
- Returns
- True on success, false otherwise
Definition at line 146 of file tcp_socket.cpp.
void urcl::comm::TCPSocket::setOptions |
( |
int |
socket_fd | ) |
|
|
protectedvirtual |
void urcl::comm::TCPSocket::setReceiveTimeout |
( |
const timeval & |
timeout | ) |
|
Setup Receive timeout used for this socket.
- Parameters
-
timeout | Timeout used for setting things up |
Definition at line 197 of file tcp_socket.cpp.
bool urcl::comm::TCPSocket::setup |
( |
std::string & |
host, |
|
|
int |
port |
|
) |
| |
|
protected |
bool urcl::comm::TCPSocket::write |
( |
const uint8_t * |
buf, |
|
|
const size_t |
buf_len, |
|
|
size_t & |
written |
|
) |
| |
Writes to the socket.
- Parameters
-
[in] | buf | Buffer of bytes to write |
[in] | buf_len | Number of bytes in the buffer |
[out] | written | Number of bytes actually written |
- Returns
- True on success, false otherwise
Definition at line 167 of file tcp_socket.cpp.
std::unique_ptr<timeval> urcl::comm::TCPSocket::recv_timeout_ |
|
protected |
std::atomic<int> urcl::comm::TCPSocket::socket_fd_ |
|
private |
The documentation for this class was generated from the following files:
ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26