|
@jayme: you can't set the return value of recv, the function determines that. Recv( is specific to a certain socket, so if the user closes the program then recv will always fail, so you need to close that socket and reinitilize it with the listen and accept functions. What you need to do is place a while(1) before your call to the listen function, and end the loop after your do ... while that receives data from the user. Then, instead of returning 1 when recv( fails, close the socket and then put continue;, so you can go to the top of the loop and listen for another user. Then the program continues as normal.
|