I have coded a socket client which sends some data to web server (apache and PHP).
It works fine if I don't use recv. If I don't wait for response of server and simply after sending all data close the socket, I see received data in PHP and it works properly. But now I need to check server's response, so I need to do recv.
I tried to set socket option with SO_RCVTIMEO also. I don't receive anything at all!
I can't receive anything from server. If I don't set SO_RCVTIMEO, my program waits on recv forever. If I set the SO_RCVTIMEO I get in numbytes = -1
Please advice! I'm sure PHP replies with some data AT LEAST HTTP header. How I can solve it?
Even if it's possible to solved using PHP code I would do it. I already added exit() call in PHP code, so I think it will close connection. But it doesn't work.
I tried Connection: Close and Connection: Keep-Alive, NONE worked.