File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes File transfer in networking..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "File transfer in networking....." Watch "File transfer in networking....." New topic

File transfer in networking.....

zniter goh

Joined: Sep 23, 2001
Posts: 29
hi everyone......
i have recently create a program that transmit and receive files
in a LAN(Local Area Network). The LAN enable me to transfer 100Mbps(MegaBits per seconds). but the tranferring speed was much slower than i drap & drop from the windows.....
at 1st i read using DataInputStream i only read and write 1 byte at a time only....but i try with 8 bytes the file may have error at the other side.....1 byte is much more safer....
can anyone tell me why.....???
and anyway to speed up.....
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
ho fast was it ?
try create a small prog which writes a files, counts the bytes and takes the time. then you can calculate the speed.
the 100Mbps is a theoretically maximum ! youll never reach that in a real network enviroment due to other traffic, colision, retrys....
what does the network look like ? how many machines, routers, hubs.... is everithing 100Mbps capable ?are the card set to 100Mbps ?
so if you get close to the limit i think this is still good. but if you miss this limit by factors, then something is wrong.
bye, hope this gives you some ideas wher to look.
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Are you using BufferedInputStream and BufferedOutputStream? These will often improve efficiency considerably. Also it will help if you use the methods for reading/writing an array of bytes, rather than one byte at a time. It sounds like your attempt to write 8 bytes at a time had a bug in it - it's worth your time to figure out what the bug was. My guess is that if you're assuming that there should always be 8 bytes in each read, then you'll have problems at the end of a file if the total size is not a multiple of 8. You should be able to read/write a variable number of bytes - the read(byte[]) method tells you how many bytes it successfully read, so use this info. Good luck.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: File transfer in networking.....
It's not a secret anymore!