Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
netui.cpp File Reference
#include <config.h>
#include <map>
#include "networking/const.h"
#include "netui.h"
#include "vsnet_serversocket.h"
#include "vsnet_oss.h"
#include "vsnet_debug.h"
#include "vsnet_headers.h"

Go to the source code of this file.

Typedefs

typedef std::map< AddressIP,
SOCKETALT
UDP_pool_type
 

Functions

static void static_initNetwork ()
 
bool bindFd (int fd, const AddressIP &remote_ip)
 

Variables

int NONBLOCKING_CONNECT = 1
 
UDP_pool_type UDP_pool
 

Typedef Documentation

typedef std::map< AddressIP, SOCKETALT > UDP_pool_type

Definition at line 203 of file netui.cpp.

Function Documentation

bool bindFd ( int  fd,
const AddressIP remote_ip 
)

Definition at line 60 of file netui.cpp.

References SOCKET_ERROR.

Referenced by NetUIBase::createClientSocket().

61 {
62  return bind( fd, (sockaddr*) &remote_ip, sizeof (struct sockaddr_in) ) != SOCKET_ERROR;
63 }
static void static_initNetwork ( )
static

Definition at line 11 of file netui.cpp.

References COUT.

Referenced by NetUIBase::createClientSocket(), NetUIBase::createServerSocket(), NetUIUDP::createServerSocket(), NetUIUDP::createSocket(), and NetUIBase::lookupHost().

12 {
13 #if defined (_WIN32) && !defined (__CYGWIN__)
14  static bool first_time = true;
15  if (first_time) {
16  first_time = false;
17 
18  COUT<<"Initializing Winsock"<<std::endl;
19  WORD wVersionRequested = MAKEWORD( 1, 1 );
20  WSADATA wsaData;
21  int res = WSAStartup( wVersionRequested, &wsaData );
22  if (res != 0)
23  COUT<<"Error initializing Winsock"<<std::endl;
24  }
25 #endif
26 }

Variable Documentation

int NONBLOCKING_CONNECT = 1

Definition at line 57 of file netui.cpp.

Referenced by NetUIBase::createClientSocket(), and VsnetHTTPSocket::lower_sendbuf().

UDP_pool_type UDP_pool

Definition at line 204 of file netui.cpp.

Referenced by NetUIUDP::createSocket(), and NetUIUDP::disconnectSaveUDP().