It will probably need a little bit more detailed description. The system make instance of my aplication (class), that should send messages between http client and server.
When system call my function to send a message to server (from one thread), I generate a message and send, then I wait for response. But when some server is offline, it can happen that I must wait 30s for timeout. But I cannot block application for so long. And I cant make for each message separate thread.
Well I think it will be best, when I make a new thread and create set, that holds pointer to every session, that send message and still havent got response. On this set I call select(). When some response come, select breaks and I send response to system with some error code.
I think it is the best way how to resolve this problem.
I will consider your advices, but please, Is there some way to get the socket or its filedescriptor?