#include
#pragma comment(lib, "Ws2_32.lib")
#include
#include
#include
#include
#include
int decode_varint(const char* buf, int& offset) {
int value = 0; // The decoded integer value
int position = 0; // Position of the current bit chunk
unsigned char current_byte;
do {
current_byte = buf[offset++];
value |= (current_byte & 0x7F) 35) {
throw std::runtime_error("VarInt is too big!");
}
} while (current_byte & 0x80); // Continue while the MSB is 1
return value;
}
std::vector encode_varint(int value) {
std::vector encoded;
do {
uint8_t temp = value & 0x7F;
value >>= 7;
if (value != 0) {
temp |= 0x80;
}
encoded.push_back(temp);
} while (value != 0);
return encoded;
}
void send_login(SOCKET client_socket, const std::string& username, const std::string& uuid) {
if (uuid.size() != 32) {
std::cerr
Подробнее здесь: https://stackoverflow.com/questions/795 ... ror-when-i
Я делаю пользовательскую структуру сервера Minecraft в C ++ и получаю ошибку, когда отправляю пакет успеха входа в систе ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение