A very typical scenario when you are coding on a real-time project which requires high stability and sustainability and in the middle someone comes and pulls your ethernet cable or usb cable (in case of mobile devices). At that time your read / recv calls gets blocked and returns after a very long time.
In Linux or Ubuntu, whenever that happens, you should call two functions which would make your read / recv to come out with an error code and they are as follows:
In Linux or Ubuntu, whenever that happens, you should call two functions which would make your read / recv to come out with an error code and they are as follows:
- shutdown - API of Linux
- closesocket - API of Linux.