1#ifndef NET_InternetSocket_h__
2#define NET_InternetSocket_h__
64 void bind(
unsigned short localPort = 0);
86 void bind( std::string_view localAddress,
unsigned short localPort = 0);
void bind(std::string_view localAddress, unsigned short localPort=0)
bind socket to address / port
unsigned short getLocalPort() const
InternetSocket(AdoptSocketTag, int sockfd, int type)
allows a subclass to take ownership of an existing socket
void bind(unsigned short localPort=0)
std::string getForeignAddress() const
InternetSocket(AddressFamily family, int type, int protocol)
allows a subclass to create new socket
std::string getLocalAddress() const
unsigned short getForeignPort() const
AddressFamily addressFamily() const noexcept
return wether this socket was created for IPv4 or IPv6
ConnectResult timedConnect(std::string_view foreignAddress, unsigned short foreignPort, int timeout)
establish a connection with the given foreign address and port
InternetSocket & operator=(InternetSocket &&other) noexcept=default
InternetSocket(InternetSocket &&other) noexcept=default
ConnectResult connect(std::string_view foreignAddress, unsigned short foreignPort)
establish a connection with the given foreign address and port
void setReuseAddress(bool enable)
Enable or disable local address reuse.
SimpleSocket(const SimpleSocket &)=delete
AddressFamily
used by internet socket types
ConnectResult
result of the connection attempt
used to safely adopt internal socket descriptor