_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
Go to the documentation of this file.
29 #ifndef __NET_LOWLEVEL_H
30 #define __NET_LOWLEVEL_H
45 # include <winsock2.h>
48 # include <sys/time.h>
50 # include <netinet/in.h>
52 # include <sys/socket.h>
53 # include <sys/ioctl.h>
57 # include <arpa/inet.h>
59 # define INVALID_SOCKET -1
64 # define INADDR_NONE -1
72 (int)(((ad) >> 24) & 0xff), (int)(((ad) >> 16) & 0xff), \
73 (int)(((ad) >> 8) & 0xff), (int)((ad) & 0xff)
99 std::vector<Socket> Sockets;
100 std::vector<int> SocketReady;
125 extern int NetSendUDP(
Socket sockfd,
unsigned long host,
int port,
const void *buf,
int len);
127 extern int NetRecvUDP(
Socket sockfd,
void *buf,
int len,
unsigned long *hostFrom,
int *portFrom);
153 #endif // !__NET_LOWLEVEL_H
int HasDataToRead(Socket socket) const
Check if a socket in a socket set is ready.
Definition: net_lowlevel.cpp:495
std::string NetGetHostname()
Get local hostname.
Definition: net_lowlevel.cpp:212
Socket NetOpenTCP(const char *addr, int port)
Open a TCP Socket port.
Definition: net_lowlevel.cpp:341
int NetSendTCP(Socket sockfd, const void *buf, int len)
Send through a TCP socket.
Definition: net_lowlevel.cpp:599
void NetCloseTCP(Socket sockfd)
Close a TCP socket port.
Definition: net_lowlevel.cpp:159
int Select(int timeout)
Wait for socket set ready.
Definition: net_lowlevel.cpp:455
int NetListenTCP(Socket sockfd)
Listen for connections on a TCP socket.
Definition: net_lowlevel.cpp:611
Socket NetAcceptTCP(Socket sockfd, unsigned long *clientHost, int *clientPort)
Accept a connection on a TCP socket.
Definition: net_lowlevel.cpp:625
int NetRecvTCP(Socket sockfd, void *buf, int len)
Receive from a TCP socket.
Definition: net_lowlevel.cpp:547
unsigned long NetResolveHost(const std::string &host)
Resolve host in name or or colon dot notation.
Definition: net_lowlevel.cpp:192
SocketSet()
Definition: net_lowlevel.h:88
int NetSetNonBlocking(Socket sockfd)
Set socket to non-blocking.
Definition: net_lowlevel.cpp:180
void AddSocket(Socket socket)
Definition: net_lowlevel.cpp:641
void DelSocket(Socket socket)
Definition: net_lowlevel.cpp:653
int NetConnectTCP(Socket sockfd, unsigned long addr, int port)
Open a TCP connection.
Definition: net_lowlevel.cpp:386
void NetCloseUDP(Socket sockfd)
Close a UDP socket port.
Definition: net_lowlevel.cpp:149
int NetSendUDP(Socket sockfd, unsigned long host, int port, const void *buf, int len)
Send through a UPD socket to a host:port.
Definition: net_lowlevel.cpp:577
int NetRecvUDP(Socket sockfd, void *buf, int len, unsigned long *hostFrom, int *portFrom)
Receive from a UDP socket.
Definition: net_lowlevel.cpp:517
void NetExit()
Hardware dependend network exit.
Definition: net_lowlevel.cpp:140
int NetInit()
Hardware dependend network init.
Definition: net_lowlevel.cpp:132
int NetSocketAddr(unsigned long *ips, int maxAddr)
Get local IPs.
Definition: net_lowlevel.cpp:270
Socket NetOpenUDP(unsigned long ip, int port)
Open a UDP Socket port. (param in network format)
Definition: net_lowlevel.cpp:308
SOCKET Socket
Definition: net_lowlevel.h:76
Definition: net_lowlevel.h:85
int NetSocketReady(Socket sockfd, int timeout)
Wait for socket ready.
Definition: net_lowlevel.cpp:421
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.