For those of you who are unfamiliar with
libevent, I will now give a brief overview and show the main parts of the code you should look at in
libevent allows us to create a socket in C, which we can use to pass the file descriptor to
libevent and give it several events to care about; for example, if a client is connecting to this socket, we can tell
libevent to listen for it and it call our callback. Other events such as errors (clients going offline) or reads (clients pushing up data) can also be handled in the same manner. We use
libevent because it's much more scalable and well defined, and it is a far better choice than writing our own polling event loop.
Once we ...