|
Util--
1.1
|
#include <utilmm/system/socket.hh>


Public Member Functions | |
| socket (int fd) | |
| socket (Domain domain, Type type, std::string const &connect_to) | |
| void | connect (std::string const &to) |
| int | read (void *buf, size_t size) const |
| int | write (void const *buf, size_t size) const |
Public Member Functions inherited from utilmm::base_socket | |
| base_socket (int fd) | |
| base_socket (Domain domain, Type type) | |
| ~base_socket () | |
| int | fd () const |
| bool | try_wait (int what) const |
| void | wait (int what) const |
| void | flush () const |
Friends | |
| class | server_socket |
Additional Inherited Members | |
Public Types inherited from utilmm::base_socket | |
| enum | Domain { Unix, Inet } |
| enum | Type { Stream, Datagram } |
| enum | Wait { WaitRead = 1, WaitWrite = 2, WaitException = 4 } |
Protected Member Functions inherited from utilmm::base_socket | |
| std::vector< uint8_t > | to_sockaddr (std::string const &to) const |
A socket connected to a remote peer
| utilmm::socket::socket | ( | int | fd | ) |
Creates a socket object from an already existing file descriptor
Opens a new socket in the specified domain and of the specified type, and connect it to connect_to. connect_to is either an IP address of the form a.b.c.d:port if domain is Inet, or a Unix socket name otherwise.
| void utilmm::socket::connect | ( | std::string const & | to | ) |
Connects or reconnects this socket to the specified peer. to is either an IP address of the form a.b.c.d:port if domain is Inet, or a Unix socket name otherwise.
| int utilmm::socket::read | ( | void * | buf, |
| size_t | size | ||
| ) | const |
Reads at most size bytes in the specified buffer and returns the count of bytes actually read.
| unix_error | raised if an error occured |
| int utilmm::socket::write | ( | void const * | buf, |
| size_t | size | ||
| ) | const |
Writes at most size bytes in the specified buffer and returns the count of bytes actually written.
| unix_error | raised if an error occured |
|
friend |
1.8.6