General Programming: In a server socket accept() method what exactly happens. At low level how server sockets are different from client sockets?
General Programming: In a server socket accept() method what exactly happens. At low level
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firstly, server sockets are generally bound to well known names (ports, in this case) and they establish themselves with
listen(). That is where the real difference happens, as client sockets establish themselves withconnect(). Callinglisten()on a socket causes the kernel’s tcp/ip implementation to begin accepting connections sent to the socket’s bound name (port). This will happen whether or not you ever callaccept().accept()simply gives your server a way to access and interact with the client sockets that have connected to your listening socket.