|
| bool | librats::init_socket_library () |
| | Initialize the socket library.
|
| |
| void | librats::cleanup_socket_library () |
| | Cleanup the socket library.
|
| |
| socket_t | librats::create_tcp_client (const std::string &host, int port, int timeout_ms=0) |
| | Create a TCP client socket and connect to a server using dual stack (IPv6 with IPv4 fallback)
|
| |
| socket_t | librats::create_tcp_server (int port, int backlog=5, const std::string &bind_address="", AddressFamily af=AddressFamily::DualStack) |
| | Create a TCP server socket and bind to a port.
|
| |
| socket_t | librats::accept_client (socket_t server_socket) |
| | Accept a client connection on a server socket.
|
| |
| std::string | librats::get_peer_address (socket_t socket) |
| | Get the peer address (IP:port) from a connected socket.
|
| |
| int | librats::send_tcp_data (socket_t socket, const std::vector< uint8_t > &data) |
| | Send data through a TCP socket.
|
| |
| std::vector< uint8_t > | librats::receive_tcp_data (socket_t socket, size_t buffer_size=1024) |
| | Receive data from a TCP socket.
|
| |
| int | librats::send_tcp_message (socket_t socket, const std::vector< uint8_t > &message) |
| | Send a length-prefixed framed message through a TCP socket.
|
| |
| std::vector< uint8_t > | librats::receive_tcp_message (socket_t socket) |
| | Receive a complete length-prefixed framed message from a TCP socket.
|
| |
| int | librats::send_tcp_string (socket_t socket, const std::string &data) |
| | Send string data through a TCP socket (converts to binary)
|
| |
| socket_t | librats::create_udp_socket (int port=0, const std::string &bind_address="", AddressFamily af=AddressFamily::DualStack) |
| | Create a UDP socket and bind to a port.
|
| |
| int | librats::send_udp_data (socket_t socket, const std::vector< uint8_t > &data, const std::string &host, int port, AddressFamily af=AddressFamily::DualStack) |
| | Send UDP data to a destination host and port.
|
| |
| std::vector< uint8_t > | librats::receive_udp_data (socket_t socket, size_t buffer_size, Peer &sender_peer, int timeout_ms=-1) |
| | Receive UDP data with optional timeout.
|
| |
| void | librats::close_socket (socket_t socket, bool force=false) |
| | Close a socket.
|
| |
| bool | librats::is_valid_socket (socket_t socket) |
| | Check if a socket is valid.
|
| |
| bool | librats::set_socket_nonblocking (socket_t socket) |
| | Set socket to non-blocking mode.
|
| |
| bool | librats::set_socket_blocking (socket_t socket) |
| | Set socket to blocking mode.
|
| |
| bool | librats::connect_with_timeout (socket_t socket, struct sockaddr *addr, socklen_t addr_len, int timeout_ms) |
| | Connect to a socket address with timeout.
|
| |
| int | librats::get_bound_port (socket_t socket) |
| | Get the port that a socket is bound to.
|
| |