libfilezilla
|
Common base clase for fz::socket and fz::listen_socket. More...
#include <socket.hpp>
Public Types | |
typedef intptr_t | socket_t |
Public Member Functions | |
int | set_buffer_sizes (int size_receive, int size_send) |
Sets socket buffer sizes. More... | |
address_type | address_family () const |
If connected, either ipv4, ipv6 or unix, unknown otherwise. | |
std::string | local_ip (bool strip_zone_index=false) const |
Returns local address of a connected socket. More... | |
int | local_port (int &error) const |
Returns local port of a connected socket. More... | |
bool | bind (std::string const &address) |
Bind socket to the specific local IP. More... | |
Protected Member Functions | |
socket_base (thread_pool &pool, event_handler *evt_handler, socket_event_source *ev_source) | |
int | close () |
void | detach_thread (scoped_lock &l) |
Protected Attributes | |
thread_pool & | thread_pool_ |
event_handler * | evt_handler_ |
socket_thread * | socket_thread_ {} |
socket_event_source *const | ev_source_ {} |
socket_t | fd_ {-1} |
unsigned int | port_ {} |
int | family_ |
int | buffer_sizes_ [2] |
Friends | |
class | socket_thread |
Common base clase for fz::socket and fz::listen_socket.
bool bind | ( | std::string const & | address | ) |
Bind socket to the specific local IP.
Undefined after having called connect/listen
std::string local_ip | ( | bool | strip_zone_index = false | ) | const |
Returns local address of a connected socket.
int local_port | ( | int & | error | ) | const |
Returns local port of a connected socket.
int set_buffer_sizes | ( | int | size_receive, |
int | size_send | ||
) |
Sets socket buffer sizes.
Internally this sets SO_RCVBUF and SO_SNDBUF on the socket.
If called on listen socket, sizes will be inherited by accepted sockets.