c++ - Socket Descriptor closed from another thread on certain condition when accept() call on the same socket is going on in Linux? -


1 thread making accept call in for(;;;) loop .on condition closesocket called , closes same socket on accept call being made . accept call gives error . ebdaf error on solaris , einval error on linux . how should overcome problem . can check socketnum state before making accept call . how should approach problem .

you cannot close socket in 1 thread while thread using it. basic problem there no way know whether other thread using socket or about use socket. , if it's about use socket, there unavoidable race conditions. mistake has caused real world problems, including 1 serious security implications.

instead, don't close socket. signal thread might using socket other way, , have thread close socket.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -