MCPcopy Create free account
hub / github.com/cppla/ServerStatus / Open

Method Open

server/src/network.cpp:5–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include "network.h"
4
5bool CNetwork::Open(NETADDR BindAddr, CNetBan *pNetBan)
6{
7 // zero out the whole structure
8 mem_zero(this, sizeof(*this));
9 m_Socket.type = NETTYPE_INVALID;
10 m_Socket.ipv4sock = -1;
11 m_Socket.ipv6sock = -1;
12 m_pNetBan = pNetBan;
13
14 // open socket
15 m_Socket = net_tcp_create(BindAddr);
16 if(!m_Socket.type)
17 return false;
18 if(net_tcp_listen(m_Socket, NET_MAX_CLIENTS))
19 return false;
20 net_set_non_blocking(m_Socket);
21
22 for(int i = 0; i < NET_MAX_CLIENTS; i++)
23 m_aSlots[i].m_Connection.Reset();
24
25 return true;
26}
27
28void CNetwork::SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser)
29{

Callers 1

InitMethod · 0.80

Calls 5

mem_zeroFunction · 0.85
net_tcp_createFunction · 0.85
net_tcp_listenFunction · 0.85
net_set_non_blockingFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected