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