sendpack qui fonctionne avec le client
This commit is contained in:
parent
590220bc92
commit
49240635b6
@ -116,5 +116,15 @@ namespace netprot {
|
||||
bool Deserialize(ErrorLog* errlog, char* buf, const uint32_t buflen); // srv
|
||||
|
||||
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 sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen) {
|
||||
netprot::Serialize(pack, buf, buflen);
|
||||
send(sock, *buf, *buflen, 0);
|
||||
*buflen = BUFFER_LENGTH;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@ private:
|
||||
std::map<Timestamp, netprot::Output> m_output_manifest;
|
||||
std::map<Timestamp, netprot::Chat> m_chatlog;
|
||||
|
||||
SOCKET m_sock;
|
||||
SOCKET m_sock_tcp, m_sock_udp;
|
||||
sockaddr_in m_addr;
|
||||
netprot::LoginInfo m_loginfo;
|
||||
netprot::PlayerInfo m_playinfo;
|
||||
|
@ -41,15 +41,15 @@ private:
|
||||
void buildIdList(size_t size);
|
||||
|
||||
uint64_t getUniqueId();
|
||||
template <class T> void sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen);
|
||||
//template <class T> void sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen);
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void Server::sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen) {
|
||||
netprot::Serialize(pack, buf, buflen);
|
||||
send(sock, *buf, *buflen, 0);
|
||||
*buflen = BUFFER_LENGTH;
|
||||
}
|
||||
//template <class T>
|
||||
//void Server::sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen) {
|
||||
// netprot::Serialize(pack, buf, buflen);
|
||||
// send(sock, *buf, *buflen, 0);
|
||||
// *buflen = BUFFER_LENGTH;
|
||||
//}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user