1. If you're not already in the habit of using snprintf instead of the older sprintf, now's the time to learn. Calls to sprintf cannot check for overflow of the destination buffer. snprintf, on the other hand, requires that the second argument be the size of the destination buffer, and this buffer will not overflow.
2. Three steps communication between network:{
These three steps, socket, bind, and listen, are the normal steps for any TCP server to prepare what we call the listening descriptor (listenfd in this example).
}
本文强调了使用snprintf而非sprintf以防止缓冲区溢出的重要性,并介绍了网络通信中TCP服务器准备监听描述符所需的三个步骤:创建套接字(socket)、绑定(bind)及监听(listen)。
2322

被折叠的 条评论
为什么被折叠?



