recv() problems using AIX 4.33

I am opening a server socket on one of our machines and connection to it on the other machine. After making the connection if ether one of the systems does a recv() and ther is no data to receive then the buffer is filled with spaces and returns. I have no way of knowing if it is valid or not. How do I get the system to return a -1 bytes received to indicate that there is nothing to be received.

This becomes a big problem when sending large files and the buffer is empty so the middle of the file is filled with blank spaces (HEX(20)).

Thanks.

Thanks for your reply. I found that I did have an error in the recv call. I have corrected the call and it works just fine now. Thanks alot for your time.