2022-01-08 18:59:40 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <SDL_net.h>
|
|
|
|
|
2022-01-08 21:23:42 -05:00
|
|
|
#define DEFAULT_MAX_PACKET_SIZE 250
|
2022-01-08 18:59:40 -05:00
|
|
|
|
|
|
|
class UDPbase
|
|
|
|
{
|
2022-01-09 23:37:48 -05:00
|
|
|
IPaddress mIPAddress;
|
2022-01-08 18:59:40 -05:00
|
|
|
public:
|
2022-01-08 21:23:42 -05:00
|
|
|
UDPbase (const char* host, const Uint16 port);
|
|
|
|
~UDPbase (void);
|
|
|
|
UDPsocket Open (void);
|
|
|
|
UDPsocket Open (const Uint16 port);
|
|
|
|
void Close (UDPsocket sock);
|
|
|
|
int Bind (UDPsocket sock, const int channel);
|
|
|
|
void Unbind (UDPsocket sock, const int channel);
|
|
|
|
std::string toString (void);
|
2022-01-09 23:37:48 -05:00
|
|
|
IPaddress* GetPeerAddress (UDPsocket sock, const int channel);
|
2022-01-08 18:59:40 -05:00
|
|
|
};
|