일단은 멀티로 접속이 됨..
This commit is contained in:
@@ -16,18 +16,21 @@ enum class Opcode : std::uint16_t {
|
||||
|
||||
struct Header {
|
||||
Opcode opcode;
|
||||
double timestamp;
|
||||
std::uint32_t body_length;
|
||||
|
||||
std::vector<char> Serialize() {
|
||||
std::vector<char> serialize(6);
|
||||
std::vector<char> serialize(14);
|
||||
::memcpy(serialize.data(), &opcode, 2);
|
||||
::memcpy(serialize.data() + 2, &body_length, 4);
|
||||
::memcpy(serialize.data() + 2, ×tamp, 8);
|
||||
::memcpy(serialize.data() + 10, &body_length, 4);
|
||||
return serialize;
|
||||
}
|
||||
|
||||
void Deserialize(std::vector<char>& data) {
|
||||
::memcpy(&opcode, data.data(), 2);
|
||||
::memcpy(&body_length, data.data() + 2, 4);
|
||||
::memcpy(×tamp, data.data() + 2, 8);
|
||||
::memcpy(&body_length, data.data() + 10, 4);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user