_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <vector>
#include <winsock2.h>
Go to the source code of this file.
Classes | |
class | SocketSet |
net_lowlevel.h - The network low level header file. | |
#define | USE_WINSOCK |
#define | INADDR_NONE -1 |
#define | NIPQUAD(ad) |
typedef SOCKET | Socket |
int | NetInit () |
Hardware dependend network init. More... | |
void | NetExit () |
Hardware dependend network exit. More... | |
unsigned long | NetResolveHost (const std::string &host) |
Resolve host in name or or colon dot notation. More... | |
int | NetSocketAddr (unsigned long *ips, int maxAddr) |
Get local IPs. More... | |
std::string | NetGetHostname () |
Get local hostname. More... | |
Socket | NetOpenUDP (unsigned long ip, int port) |
Open a UDP Socket port. (param in network format) More... | |
void | NetCloseUDP (Socket sockfd) |
Close a UDP socket port. More... | |
int | NetSendUDP (Socket sockfd, unsigned long host, int port, const void *buf, int len) |
Send through a UPD socket to a host:port. More... | |
int | NetRecvUDP (Socket sockfd, void *buf, int len, unsigned long *hostFrom, int *portFrom) |
Receive from a UDP socket. More... | |
Socket | NetOpenTCP (const char *addr, int port) |
Open a TCP Socket port. More... | |
void | NetCloseTCP (Socket sockfd) |
Close a TCP socket port. More... | |
int | NetConnectTCP (Socket sockfd, unsigned long addr, int port) |
Open a TCP connection. More... | |
int | NetSendTCP (Socket sockfd, const void *buf, int len) |
Send through a TCP socket. More... | |
int | NetRecvTCP (Socket sockfd, void *buf, int len) |
Receive from a TCP socket. More... | |
int | NetListenTCP (Socket sockfd) |
Listen for connections on a TCP socket. More... | |
Socket | NetAcceptTCP (Socket sockfd, unsigned long *clientHost, int *clientPort) |
Accept a connection on a TCP socket. More... | |
int | NetSetNonBlocking (Socket sockfd) |
Set socket to non-blocking. More... | |
int | NetSocketReady (Socket sockfd, int timeout) |
Wait for socket ready. More... | |
#define INADDR_NONE -1 |
#define NIPQUAD | ( | ad | ) |
#define USE_WINSOCK |
typedef SOCKET Socket |
Accept a connection on a TCP socket.
Accept a connection on a TCP socket.
sockfd | Socket |
clientHost | host of the client connected. |
clientPort | port of the client connected. |
Close a TCP socket port.
Close a TCP socket port.
sockfd | Socket fildes |
Close a UDP socket port.
Close an UDP socket port.
sockfd | Socket fildes |
int NetConnectTCP | ( | Socket | sockfd, |
unsigned long | addr, | ||
int | port | ||
) |
void NetExit | ( | ) |
Hardware dependend network exit.
Hardware dependend network exit.
std::string NetGetHostname | ( | ) |
Get local hostname.
Return the system hostname.
int NetInit | ( | ) |
Hardware dependend network init.
Hardware dependend network init.
int NetListenTCP | ( | Socket | sockfd | ) |
Listen for connections on a TCP socket.
Listen for connections on a TCP socket.
sockfd | Socket |
Socket NetOpenTCP | ( | const char * | addr, |
int | port | ||
) |
Socket NetOpenUDP | ( | unsigned long | ip, |
int | port | ||
) |
Receive from a TCP socket.
Receive from a TCP socket.
sockfd | Socket |
buf | Receive message buffer. |
len | Receive message buffer length. |
Receive from a UDP socket.
Receive from a UDP socket.
sockfd | Socket |
buf | Receive message buffer. |
len | Receive message buffer length. |
hostFrom | host of the sender. |
portFrom | port of the sender. |
unsigned long NetResolveHost | ( | const std::string & | host | ) |
Resolve host in name or or colon dot notation.
Resolve host in name or dotted quad notation.
host | Host name (f.e. 192.168.0.0 or stratagus.net) |
Send through a TCP socket.
Send through a TCP socket.
sockfd | Socket |
buf | Send message buffer. |
len | Send message buffer length. |
Send through a UPD socket to a host:port.
Send through a UPD socket to a host:port.
sockfd | Socket |
host | Host to send to (network byte order). |
port | Port of host to send to (network byte order). |
buf | Send message buffer. |
len | Send message buffer length. |
int NetSetNonBlocking | ( | Socket | sockfd | ) |
Set socket to non-blocking.
Set socket to non-blocking.
sockfd | Socket |
int NetSocketAddr | ( | unsigned long * | ips, |
int | maxAddr | ||
) |
Get local IPs.
Get IP-addrs of local interfaces from Network file descriptor
sock | local socket. |
ips | where to stock ip addrs. |
maxAddr | size of ips. |
int NetSocketReady | ( | Socket | sockfd, |
int | timeout | ||
) |
Wait for socket ready.
Wait for socket ready.
sockfd | Socket fildes to probe. |
timeout | Timeout in 1/1000 seconds. |