sP2P c++ STL *nix API  1.2
NAT traversal and peer-to-peer networking API providing all utilities needed to build peer-to-peer application straigth out of box
 All Classes Functions Variables Typedefs Enumerations Enumerator
sp2plib::NetworkHelper Class Reference

Usefull socket functions. More...

#include <NetworkHelper.h>

Static Public Member Functions

static IP4Address getBindAddressForRemoteAddress (char *host)
 Gets local address socket will bind to when connecting to remote host
 
static IP4Address getBindAddressForRemoteAddress (IP4Address RemoteAddress)
 /Gets local address socket will bind to when connecting to remote address
 
static IPEndPoint getSocketBindingPoint (Socket &sock)
 Gets local end point socket is bound to
 
static bool getInterfaceCanTcpAccept (IP4Address localInterfaceAddress)
 Gets value indicating local socket ca do ::accept with given local address, if use provide 0.0.0.0 - ANY or 127.0.0.1 you will alwause get true, point is to check actual address (getting false from this function is good indication that interface is 3g)
 
static int dataAvailable (Socket sock)
 Gets amount of read data available for socket
 

Detailed Description

Usefull socket functions.

Member Function Documentation

static int sp2plib::NetworkHelper::dataAvailable ( Socket  sock)
static

Gets amount of read data available for socket

Parameters
sockSocket to get info from.
Returns
Number of available bytes.
static IP4Address sp2plib::NetworkHelper::getBindAddressForRemoteAddress ( char *  host)
static

Gets local address socket will bind to when connecting to remote host

Parameters
hostRemote host
Returns
The local bind address for host remote address
static IP4Address sp2plib::NetworkHelper::getBindAddressForRemoteAddress ( IP4Address  RemoteAddress)
static

/Gets local address socket will bind to when connecting to remote address

Parameters
RemoteAddressThe remote address.
Returns
The local bind address for remote address.
static bool sp2plib::NetworkHelper::getInterfaceCanTcpAccept ( IP4Address  localInterfaceAddress)
static

Gets value indicating local socket ca do ::accept with given local address, if use provide 0.0.0.0 - ANY or 127.0.0.1 you will alwause get true, point is to check actual address (getting false from this function is good indication that interface is 3g)

Parameters
sockLocal address to check
Returns
True if accept is fuctioning, otherwise false
static IPEndPoint sp2plib::NetworkHelper::getSocketBindingPoint ( Socket &  sock)
static

Gets local end point socket is bound to

Parameters
sockSocket to get info from
Returns
The socket bind point.

The documentation for this class was generated from the following file: