469,643 Members | 1,225 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

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?

Sep 8 '06 #1
2 2282
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.

HTH

Ciaran O'Donnell

"Pramod" wrote:
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?

Sep 8 '06 #2
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?

Ciaran O''Donnell wrote:
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.

HTH

Ciaran O'Donnell

"Pramod" wrote:
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?
Sep 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Lingyun Yang | last post: by
11 posts views Thread by Abhishek | last post: by
11 posts views Thread by Stephan Steiner | last post: by
8 posts views Thread by Xarky | last post: by
1 post views Thread by Alex | last post: by
10 posts views Thread by David | last post: by
2 posts views Thread by tedpottel | last post: by
6 posts views Thread by Thom Little | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.