Polyphase Game Engine
Loading...
Searching...
No Matches
Network.h
Go to the documentation of this file.
1#pragma once
2
4
7void NET_Update();
8
10
11SocketHandle NET_SocketCreate();
12void NET_SocketBind(SocketHandle socketHandle, uint32_t ipAddr, uint16_t port);
13int32_t NET_SocketRecv(SocketHandle socketHandle, char* buffer, uint32_t size);
14int32_t NET_SocketRecvFrom(SocketHandle socketHandle, char* buffer, uint32_t size, uint32_t& addr, uint16_t& port);
15int32_t NET_SocketSendTo(SocketHandle socketHandle, const char* buffer, uint32_t size, uint32_t addr, uint16_t port);
16void NET_SocketClose(SocketHandle socketHandle);
17void NET_SocketSetBlocking(SocketHandle socketHandle, bool blocking);
18void NET_SocketSetBroadcast(SocketHandle socketHandle, bool broadcast);
19void NET_SocketGetIpAndPort(SocketHandle socketHandle, uint32_t& ipAddr, uint16_t& port);
20
21// ---------------------------------------------------------------------------
22// TCP / stream-oriented primitives. Used by HTTP/HTTPS, websockets, and any
23// future protocol that needs reliable streaming. UDP-only platforms can leave
24// these as no-op stubs that return failure.
25// ---------------------------------------------------------------------------
27bool NET_SocketConnect(SocketHandle socketHandle, uint32_t ipAddr, uint16_t port, int32_t timeoutMs);
28int32_t NET_SocketSend(SocketHandle socketHandle, const char* buffer, uint32_t size);
29
30// Synchronous DNS resolve. Returns 0 on failure. Hostname may be a literal IP.
31uint32_t NET_ResolveHost(const char* hostname);
32
33uint32_t NET_IpStringToUint32(const char* ipString);
34void NET_IpUint32ToString(uint32_t ipUint32, char* outIpString);
35
38
39// TODO: Update LAN servers on NET_Update()
40//void NET_GetLanServers();
int32_t NET_SocketSendTo(SocketHandle socketHandle, const char *buffer, uint32_t size, uint32_t addr, uint16_t port)
void NET_Initialize()
SocketHandle NET_SocketCreateStream()
int32_t NET_SocketRecvFrom(SocketHandle socketHandle, char *buffer, uint32_t size, uint32_t &addr, uint16_t &port)
int32_t NET_SocketSend(SocketHandle socketHandle, const char *buffer, uint32_t size)
void NET_Update()
void NET_SocketClose(SocketHandle socketHandle)
uint32_t NET_GetSubnetMask()
void NET_SocketSetBroadcast(SocketHandle socketHandle, bool broadcast)
bool NET_IsActive()
void NET_SocketSetBlocking(SocketHandle socketHandle, bool blocking)
uint32_t NET_GetIpAddress()
bool NET_SocketConnect(SocketHandle socketHandle, uint32_t ipAddr, uint16_t port, int32_t timeoutMs)
void NET_SocketGetIpAndPort(SocketHandle socketHandle, uint32_t &ipAddr, uint16_t &port)
uint32_t NET_ResolveHost(const char *hostname)
int32_t NET_SocketRecv(SocketHandle socketHandle, char *buffer, uint32_t size)
void NET_SocketBind(SocketHandle socketHandle, uint32_t ipAddr, uint16_t port)
SocketHandle NET_SocketCreate()
void NET_Shutdown()
void NET_IpUint32ToString(uint32_t ipUint32, char *outIpString)
uint32_t NET_IpStringToUint32(const char *ipString)