I am trying to send a file from a server I have written.

From the server I am reading the file into a buffer and then sending the data.

Client Receive Code

Code:
Client::receive_from_server()
{


for(int i=0; i < NO_ITERATIONS; i++)
    {
    int byte_count = 0;
    if((byte_count = client_stream_.recv_n(data_buf_, ACE_OS::strlen(data_buf_) +1, 0)) == -1)
        {
        std::cout << "Data Not Received";
        }
    else
        {
        data_buf_[byte_count] = 0;
        ACE_DEBUG((LM_DEBUG, "Server received" "%s \n", data_buf_));
        }

     }

}


When I receive the data on the client end however the data is truncated, and is getting mixed together.

Send Code from Server

Code:
Server::handle_connection()
{


std::fstream diag_file_("diagnostics.txt", ios::in);

while(!diag_file_.eof() && !diag_file_.fail())
    {
    std::string data_;
    std::getline(diag_file_, data_,'\n');
    data_buf_ = data_.c_str();

    if(new_stream_.send_n(data_buf_, ACE_OS::strlen(data_buf_)+1, 0) == -1)
        {
        ACE_ERROR((LM_ERROR, "%p\n", "Data Sent"));
        }

    }

if(new_stream_.close() == -1)
    ACE_ERROR((LM_ERROR, "%p\n", "close"));


return 0;

}
I have never wrote a network app like this, so I may be sending the data wrong from the server. I have been able to succesfully send data correctly ("Hello Server"), by assigning it to data_buf_ in my Server constructor.

I am using ACE ( Adaptive Communication Environment).

Any suggestions or resources would be very helpful. If more information is needed please let me know.

Thanks