I need to send many chunks of a file through a socket ... while looping, the client need to check for incoming messages from the server.

ex:

Code:
while(1)
{
//check for incoming message from server
if (message) then recv();
else then continue sending;
}
if I use recv() for checking for incoming message, the program is blocked.

Is using poll() a good way to make it work ?

Thanks