C++ network programming

To understand sockets and use them right, you need The Sockets Bible: W. Richard Stevens, Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition) You absolutely must have this book before you sit down to write a line of sockets code. Don’t leave home without it. Really. Starting around $35 used at Amazon. EDIT: The OP asked about … Read more

What is AF_INET, and why do I need it?

AF_INET is an address family that is used to designate the type of addresses that your socket can communicate with (in this case, Internet Protocol v4 addresses). When you create a socket, you have to specify its address family, and then you can only use addresses of that type with the socket. The Linux kernel, for … Read more

What does “connection reset by peer” mean?

It’s fatal. The remote server has sent you a RST packet, which indicates an immediate dropping of the connection, rather than the usual handshake. This bypasses the normal half-closed state transition. I like this description: “Connection reset by peer” is the TCP/IP equivalent of slamming the phone back on the hook. It’s more polite than merely … Read more