1 #ifndef NETWORK_H_INCLUDED
2 #define NETWORK_H_INCLUDED
4 #include <SDL2/SDL_net.h>
9 static inline UDPsocket
OpenPort(uint16_t port
) {
10 UDPsocket sock
= SDLNet_UDP_Open(SDL_SwapLE16(port
));
12 SDL_Log("SDLNet_UDP_Open: %s\n", SDLNet_GetError());
18 static inline void ClosePort(UDPsocket sock
) {
19 SDLNet_UDP_Close(sock
);
22 void SendMessage(UDPsocket sock
, IPaddress address
, ProtocolMessage m
);
23 bool RecvMessage(UDPsocket sock
, IPaddress
* address
, ProtocolMessage
* m
);
24 bool WaitMessage(UDPsocket sock
, IPaddress
* address
, ProtocolMessage
* m
, uint32_t timeout
);
26 #endif /* NETWORK_H_INCLUDED */