Hi everyone. My friends recommended me to this site. Hopefully someone out there knows a bit about the Socket Api. ... I am trying to transfer a text file from one folder to another (all on the same machine).

On the server side, I am able to put the entire text I want to transfer in a buffer. I try to transfer the file to another folder (client) but only part of the text is transferred. Can anyone hypothesize why only part of the text is being transferred?

here is the line that does the transfer on the server side:

if (send(new_socket,buffer,strlen(buffer),0)!=strlen(buffer)) .

I know buffer contains the entire text because i tested with a print statement.

On the client side, here is the code that receives the text.


rc3 = recv( cs , &mess3 , 1000000 , 0 ) ;

I send mess3 to a text file but only part of the text comes out.

Any guesses anyone?

Cheers
CompSec

try flushing the data

Guess 1:
Your buffers are to small.
Guess 2:
Your network is lazy)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.