TCP client terminating abruptly without any error message

I have created a TCP server-client application in C++, where client first sends login request and server checks the credentials and if they are proper then server reads sample file and sends that data to client. After sending first login request client only receives data from server and writes it to another file, but don't send anything back to server.

This works fine till certain size, but sometimes after writing few gigabytes of data (which is not fix and can fail at 2gb or 6gb as well) in destination file, the client application stops abruptly, without any message on console.

I'm using fread()/send() system calls at Server side and read()/fwrite() system calls at client side.

Running this on CentOS-7. I have tried to run this in gdb as well, but don't see any crash or receipt of any signal there.
What sort of error checking, recovery, retry do you have?

Are you assuming for example that n == len is always true regardless?
n = send( sock, buffer, len, 0 );

Some code to look at would be better.
Registered users can post here. Sign in or register to post.