File transfer



Hi all,
I have created a chat application, and one of it's functionality to
send files to the connected user.
I read the contents of the files into a Byte array and send that
through sockets.
Now when i send a file of 150 kb size the file seems to be corrupted at
the receivers end.
some part of the file is not received.
Is there any restriction of size for sending files across internet
using sockets?

I am able to send small files without any problem.
When i run the same application locally, i am able to send huge files
of 3-4 MB easily.

Can anyone point out why this is happening?


You might have a problem with not all the data being sent. Are you flushing
the socket after writing everything. I have implemented a system similar
before but I had a control channel setup which enabled me to inform the
reciever first of the total number of bytes in the file. I was then able to
wait till they all arrived but they didn't until the sender flushed.


Ciaran O'Donnell


Thanks for the reply,
I have done the same thing, i send the size first and initialize the
byte array of that size,
but still it doesn't works.
I am having the chat server application on a server that is situated in
US and i am
running the client app from here in India.
Does the Internet connection creates any problem?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads