Java Network File Transfer Tool
Overview
This is a program that allows transferring files over a network from the client to the server. It is part of my prep work for a P2P app I'm slowly working on. It tries to do everything 'correctly', such as buffered socket connections transfer and writing of large blocks at a time, etc. So it is larger than you'd think for a relatively simple task.
Downloads
- fileTransClient.java -- The network client code that sends the file to the server
- fileTransServer.java -- The network server code that receives files from clients
- fileTrans.tar.gz -- Tarball of all the code together with a simple makefile
Conclusion
Works just fine, I eventually need to make it symmetrical to use for the final program(IE if either can act as a server the can communicate both ways). It should be able to handle files up to 2TB, I've tested about 2GB files.
Update
Someone wrote in and pointed out a bug with certain files being transferred(The server was closing before the client). Turns out that Java signs byte values, so any bytes being converted with the MSB as 1 were actually subtracting from the total value, making the server expect a smaller file size. Since Java has no concept of signed vs. unsigned, you have to mask the value and convert to type with more bits. For example:
byte b = 211; // Binary is 11010011
int i = (int)(b);
System.out.println("Value: " + i);
will spit out: Value: -45
So you have to first do a mask each time you are converting a byte:
byte b = 211;
int i = (int)( b & 0xFF );
System.out.println("Value: " + i);
Now you get what you'd expect: Value: 211
Comments(0)
2008-12-19 23:54:25
Add your comment:
Hardware
Software
- TAIM (Alpha Version): GHCI integration with vim
- CheaTorrent -- An evil BitTorrent client
- Self Modifying 2D Turing Automata
- Competing Conway Life Automata
- X11 Timelapse Desktop Video
- Colored Wolfram Automata With Sound Input
- Pseudo Video Feedback in Processing
- Haskell Cipher Saber
- Illegal FIlenames -- Windows and *nix
- Simple Perl SDL Music Keyboard (Updated)
- Image to Spectrogram
- Pastebin Hell
- OMGWTFRNG (OWR)
- OTP Enhancement : Failure Report
- Java Network File Transfer Tool
- AES Encrypted Filesystem Speeds
- Dual Message Encryption
- PHP Website
- Mp3 Splitting Script
- Random Obfuscation Tool
- Filesystem Speed Comparisons
- Java Based Web Server GUI