Classes | Namespaces | Typedefs | Enumerations | Functions

wavesock.h File Reference

#include "common/common.h"
Include dependency graph for wavesock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  netlib::ip_addr_t
 representation of IP address (abstracts IPv4 and IPv6) More...
struct  netlib::address_t
 holds the IP address and port of a remote host More...


namespace  netlib


typedef std::map< std::string,
ip_addr_t > 
 a map of IP addresses (typically interface name --> IP address)
typedef void * netlib::ws_set_t


enum  netlib::eWSError {
  netlib::eWS_Okay = 0,
  netlib::eWS_Again = 1,
  netlib::eWS_Denied = 2,
  netlib::eWS_InUse = 3,
  netlib::eWS_ConnectionRefused = 4,
  netlib::eWS_Unknown = 0x100,
  netlib::eWS_Invalid = 0x7ff

these are error codes.



bool netlib::getLocalInterfaces (map_ip_addr_t &interfaces)
 get set of local interfaces
bool netlib::wsIsValidSocket (int s) throw ()
 is the given socket identifier valid?
eWSError netlib::wsGetError (void) throw ()
 gets the current error (0 means no error).
void netlib::wsGetErrorMessage (char *buffer,int bufferSize) throw ()
 returns the most recent error message
int netlib::wsCreateTcpSocket (void) throw ()
 creates a socket that can be used for TCP
int netlib::wsCreateUdpSocket (bool broadcast) throw ()
 creates a socket that can be used for UDP
int netlib::wsBindToPort (int s,int port) throw ()
 binds the given socket to a specific local port for UDP or TCP returns 0 on success, -1 for error.
int netlib::wsListen (int s,int maxBacklog) throw ()
 usually used for TCP listening sockets.
int netlib::wsConnect (int s,const address_t &server) throw ()
 makes a connection to the specified server
int netlib::wsReceive (int s,char *buffer,int bufferSize) throw ()
 receives data (typically from TCP).
int netlib::wsReceiveFrom (int s,char *buffer,int bufferSize,address_t &from) throw ()
 receives data (typically from UPD).
int netlib::wsSend (int s,const char *buffer,int bufferSize) throw ()
 sends data (typically for TCP).
int netlib::wsSendTo (int s,const char *buffer,int bufferSize,const address_t &to) throw ()
 sends data (typically for UDP).
int netlib::wsAccept (int s,address_t &address) throw ()
 accepts an incoming request.
ws_set_t netlib::wsCreateSet (void)
 creates an object that you can clear, and then populate with sockets.
void netlib::wsClearSet (ws_set_t set) throw ()
 clears the given set
void netlib::wsAddSocketToSet (ws_set_t set,int s) throw ()
 adds the given socket to the given set
bool netlib::wsIsSocketInSet (ws_set_t set,int s) throw ()
 is the given socket in the set?
void netlib::wsDestroySet (ws_set_t set) throw ()
 destroys the given set
int netlib::wsSelect (int maxSocket,ws_set_t readers,ws_set_t writers,long wait_microseconds) throw ()
 waits until a socket is ready for read/write.
void netlib::wsCloseSocket (int s) throw ()
 closes a socket