What are Async Sockets? How are they different from normal sockets (Blocking and Non-Blocking)?
Any pointers in that direction or any links to tutorials will be helpful.
Thanks.
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.
There are three ways to communicate with sockets in async way:
Open regular socket, but do not read from it (because
read()blocks) until you know there it something to be read. You can useselect()orpoll()to check whether there are data to read from socket(s), and if there is something, read it, asread()won’t block.Switch socket to non-blocking I/O, by setting
O_NONBLOCKflag withfcntl()function. In this caseread()won’t block.Set socket’s
O_ASYNCflag usingFIOASYNCoption ofioctl()(see man 7 socket for details). In this case you will receiveSIGIOsignal when there is something to read from socket.Third approach is async socket.