SimpleSocket  0.1
Some wrappers that make using sockets easier in C++
All Classes Files Functions Pages
Functions
swrappers.hh File Reference

Set of C++ friendly wrappers around socket-relevant calls. More...

#include <boost/utility/string_ref.hpp>
#include "comboaddress.hh"
Include dependency graph for swrappers.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SSocket (int family, int type, int flags=0)
 Create a socket. Error = exception.
 
int SConnect (int sockfd, const ComboAddress &remote)
 Connect a socket. Error = exception.
 
int SBind (int sockfd, const ComboAddress &local)
 Bind a socket. Error = exception.
 
int SAccept (int sockfd, ComboAddress &remote)
 Accept a new connection on a socket. Error = exception.
 
int SListen (int sockfd, int limit)
 Enable listen on a socket. Error = exception.
 
int SSetsockopt (int sockfd, int level, int opname, int value)
 Set a socket option. Error = exception.
 
void SWrite (int sockfd, boost::string_ref content, std::string::size_type *wrlen=0)
 Attempt to write string to the socket. Partial write is an exception if 'wrlen' not set. Otherwise wrlen gets size of written data, and no exception.
 
std::string SRead (int sockfd, std::string::size_type limit=std::numeric_limits< std::string::size_type >::max())
 
void SetNonBlocking (int sockfd, bool to=true)
 Set a socket to (non) blocking mode. Error = exception.
 
std::vector< ComboAddressresolveName (boost::string_ref name, bool ipv4=true, bool ipv6=true)
 Use system facilities to resolve a name into addresses. If no address found, returns empty vector.
 

Detailed Description

Set of C++ friendly wrappers around socket-relevant calls.