Hello all,
im quite new to network programming,im writing c code which dealt with transferring files using TCP over Sockets,
In my code,client sends the header information(information about the file ) to the server ,the code works fine
but received file size is sporadically a small than the file that is sent...
can anybody explain????????????????

typedef struct
{
    int i;
    int j;
    char buff[16384] //16k
}BUFFER;



for(i = 0 ;i < m ;i++)
{
    for(j = 0 ;j <n;j++)
    {
        if(send(sd,recvbuff,sizeof(BUFFER),0) == -1)
        {
            perror("send");
            exit(1);
        }
        //recv ack
    }
}

Recommended Answers

All 2 Replies

Your code is not indicative of what you are trying to do. I'm unclear on the problem you are having. Are you suggesting that the file size is incorrect on the client side or that the file is never properly sent?

Can you elaborate and perhaps provide examples of the actual code you are using?

Also, show the server-side code as well as the client.

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.