New answers tagged

2

There are a few things I'd like to point out The Server class It would be nice to be able to tell the server to listen on a different port, presumably by making the Server class' constructor take the port number as a parameter When you have a pair of lists that need to be kept in sync, it's often better to have a list of pairs instead. But in this case, ...


4

text_type is really an "encoding", not a type, so there is a better variable name than this server should not be a global server should be wrapped in a with - see here about the docs calling out support for context management, and here for general information on context management Never try/except; you're going to want to catch a more specific ...


1

Nicely written Alternative zeroing // struct sockaddr_un saddr; // memset(&saddr, 0, sizeof saddr); struct sockaddr_un saddr = {0}; Off-by-1 limit? Perhaps // if (*s == '\0' || *ep != '\0' || l <= 0 || l >= INT_MAX / SECONDS) if (*s == '\0' || *ep != '\0' || l <= 0 || l > INT_MAX / SECONDS) Safer subtraction After timespecsub(a, b, c) ...


2

Naming things There are several ways in which you can improve the way you name things. For example, don't do unnecessary abbreviations. Why NetworkBuff instead of NetworkBuffer? If you do want to abbreviate, make sure you do it the same way as other things do. For example, as you've already seen, the standard library provides std::streambuf, so NetworkBuf ...


2

I tried to compile it in Visual Studio 2019. I got several warnings and 1 error. I would recommend the following change to the SocketIOError class because the what function caused a warning: class SocketIOError : public std::exception { private: std::string type; std::string msg; public: SocketIOError(std::string t) : type(t) {...


Top 50 recent answers are included