erratas dans la sérialisation

This commit is contained in:
MarcEricMartel
2023-10-24 09:17:21 -04:00
parent ffeb95d953
commit cf6e58cd95
3 changed files with 19 additions and 10 deletions

View File

@@ -118,6 +118,7 @@ namespace netprot {
PacketType getType(char* buf, uint32_t buflen); // srv/cli
template <class T> void sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen);
template <class T> void sendPackTo(SOCKET sock, T* pack, char** buf, uint32_t* buflen, sockaddr_in* sockad);
template <class T>
void sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen) {
@@ -126,6 +127,14 @@ namespace netprot {
*buflen = BUFFER_LENGTH;
}
template <class T>
void sendPackTo(SOCKET sock, T* pack, char** buf, uint32_t* buflen, sockaddr_in* sockad) {
sockaddr_in addr = *sockad;
netprot::Serialize(pack, buf, buflen);
sendto(sock, *buf, *buflen, 0, (sockaddr*)&addr, sizeof(addr));
*buflen = BUFFER_LENGTH;
}
};
#endif