8 #ifndef INCLUDE_WALLABY_SOCKET_HPP_
9 #define INCLUDE_WALLABY_SOCKET_HPP_
15 #include <netinet/in.h>
18 #define _WIN32_WINNT 0x0501
22 typedef u_long socklen_t;
43 unsigned short port()
const;
45 const sockaddr *
addr()
const;
48 const char *
ip()
const;
60 bool open(
int domain,
int type,
int protocol);
64 bool bind(
const unsigned short port);
70 ssize_t
recv(
void *
const buffer,
const size_t length,
int flags = 0);
71 ssize_t
recvfrom(
void *
const buffer,
const size_t length,
Address &address,
int flags = 0);
73 ssize_t
send(
const void *
const buffer,
const size_t length,
int flags = 0);
74 ssize_t
sendto(
const void *
const buffer,
const size_t length,
const Address &dest,
int flags = 0);
Definition: socket.hpp:32
bool setHost(const char *const host)
Address(const char *const host, const unsigned short port)
Address(const sockaddr_in &addr)
const sockaddr * addr() const
void setPort(const unsigned short port)
socklen_t addrLength() const
unsigned short port() const
Definition: socket.hpp:56
ssize_t recv(void *const buffer, const size_t length, int flags=0)
ssize_t send(const void *const buffer, const size_t length, int flags=0)
ssize_t recvfrom(void *const buffer, const size_t length, Address &address, int flags=0)
bool setReusable(const bool reusable)
bool setBlocking(const bool blocking)
bool connect(const Address &addr)
bool bind(const unsigned short port)
bool open(int domain, int type, int protocol)
ssize_t sendto(const void *const buffer, const size_t length, const Address &dest, int flags=0)
int socket_fd_t
Definition: socket.hpp:27