13 #ifndef __PROCESS_NETWORK_HPP__
14 #define __PROCESS_NETWORK_HPP__
33 sockaddr_storage storage;
34 socklen_t length =
sizeof(storage);
48 sockaddr_storage storage =
address;
50 const socklen_t address_size =
static_cast<socklen_t
>(address.
size());
51 if (
net::bind(s, (sockaddr*) &storage, address_size) < 0) {
62 sockaddr_storage storage =
address;
64 const socklen_t address_size =
static_cast<socklen_t
>(address.
size());
65 if (
net::connect(s, (sockaddr*) &storage, address_size) < 0) {
81 sockaddr_storage storage;
82 socklen_t length =
sizeof(storage);
84 if (::getsockname(s, (sockaddr*)&storage, &length) < 0) {
100 sockaddr_storage storage;
101 socklen_t length =
sizeof(storage);
103 if (::getpeername(s, (sockaddr*)&storage, &length) < 0) {
113 #endif // __PROCESS_NETWORK_HPP__
Try< int_fd > socket(int family, int type, int protocol)
Definition: socket.hpp:31
int bind(const os::WindowsFD &fd, const sockaddr *addr, socklen_t addrlen)
Definition: socket.hpp:120
static Try< Address > create(const sockaddr_storage &storage)
Definition: address.hpp:294
Definition: nothing.hpp:16
os::WindowsFD accept(const os::WindowsFD &fd, sockaddr *addr, socklen_t *addrlen)
Definition: socket.hpp:113
Try< Address > address(int_fd s)
Returns the Address with the assigned ip and assigned port.
Definition: network.hpp:79
int connect(const os::WindowsFD &fd, const sockaddr *address, socklen_t addrlen)
Definition: socket.hpp:128
Definition: address.hpp:277
Definition: errorbase.hpp:49
size_t size() const
Definition: address.hpp:360
ErrnoError SocketError
Definition: error.hpp:33
Try< int_fd > accept(int_fd s)
Definition: network.hpp:31
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
Try< Nothing, SocketError > connect(int_fd s, const Address &address)
Definition: network.hpp:60
Try< Address > peer(int_fd s)
Returns the peer's Address for the accepted or connected socket.
Definition: network.hpp:98
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
int int_fd
Definition: int_fd.hpp:35
std::string stringify(int flags)