this is not a clickbait, i have never taken any drugs.
For background: i started to learn how to use the asio library in c++ and let me tell you i don’t enjoy it very much, i do it only for the good grades in school.
after a long studying session i tried to sleep so my brain configured a socket and started to listen to new connections. all night i got errors and almost no connections that approved my brain to fall asleep. this is not a joke nor a dream, i remember standing up and telling myself that i’m not a socket but my brain couldn’t comprehend this thought. after about 10 minutes i continued listening for connections as before until the morning which finally i fell asleep
here is the code to visualize what i felt in this very black night (reminder i thought i was the socket)
#include
#include
using namespace asio;
class Session : public std::enable_shared_from_this {
public:
Session(io_context& context) : socket_(context) {}
ip::tcp::socket& getSocket() {
return socket_;
}
void start() {
readData();
}
void readData() {
auto self(shared_from_this());
socket_.async_read_some(buffer(data_), [this, self](const std::error_code& ec, std::size_t length) {
if (!ec) {
std::string receivedData(data_, length);
if (receivedData == "fall asleep OK") {
} else {
socket_.close();
}
}
});
}
private:
ip::tcp::socket socket_;
char data_[1024];
};
what do you guys make of this? am i the only one?
I feel you. If you code too long and fall asleep you keep coding. I vividly remember how I was typewriting in my sleep and my fingers probably moved.
If this is serious you should make an appointment with a psychiatrist. Sounds like a dissociative episode which can indicate serious mental health issues.