One of my Steam friends apparently got to play some very early alpha versions of these games.
S
Scintillo
@Scintillo
0
Reputation
2
Posts
22
Profile views
0
Followers
0
Following
Best posts made by Scintillo
This user hasn't posted anything yet.
Latest posts made by Scintillo
-
Early alpha versions
-
Debugging networking code
I spent about an hour debugging my networking code. It seemed to connect correctly but then mystically disconnect right away. I tried everything from moving server's io_service to another thread to running it on a different computer. Then I noticed my Connection::send method.
void Connection::send(PacketType type, Buffer* content) { socket.close(); Buffer* header = new Buffer(); header->putInt<uint16_t>((uint16_t) type); header->putInt<uint32_t>(content->size()); std::vector<ba::const_buffer> buffers; buffers.push_back(ba::buffer(header->pointer(), header->size())); buffers.push_back(ba::buffer(content->pointer(), content->size())); auto handler = bind(&Connection::sent, this, ba::placeholders::error, ba::placeholders::bytes_transferred, header, content); ba::async_write(socket, buffers, handler); }
Just one thought came into my mind: What the fuck I was thinking when I wrote that line of code!?