#ifndef NETWORK_H_INCLUDED #define NETWORK_H_INCLUDED #include #include #include "protocol.h" static inline UDPsocket OpenPort(uint16_t port) { UDPsocket sock = SDLNet_UDP_Open(SDL_SwapLE16(port)); if(!sock) { SDL_Log("SDLNet_UDP_Open: %s\n", SDLNet_GetError()); exit(1); } return sock; } static inline void ClosePort(UDPsocket sock) { SDLNet_UDP_Close(sock); } void SendMessage(UDPsocket sock, IPaddress address, ProtocolMessage m); bool RecvMessage(UDPsocket sock, IPaddress * address, ProtocolMessage * m); bool WaitMessage(UDPsocket sock, IPaddress * address, ProtocolMessage * m, uint32_t timeout); #endif /* NETWORK_H_INCLUDED */