i m developing an application to backup files\directories to a server..
i initially developed it in RMI but then to make it possible to run over Internet i made some modifications and used sockets..
I have designed few packets for sending login details, file information to be backed-up, file data, etc. to server. The server parses the packets, identifies the type of packet and takes action accordingly.
Problem is that the application works fine, throws no exception but the data transfered gets corrupted. This is the case only with data packet.
Other packets; like login packet, file information packet; aint get corrupted. The action taken on receipt of these packets are as desired.
Sometimes the data is not corrupted while most of the time it is..
I test the app by backing up an image file so that its easy to check the backed-up file. I test the application on same PC.
I have created a thread to listen incoming data on client and server side, each.
Right now m testing the app on same PC.
Can anyone guide me what might be wrong with the code?? Any do's or dont's in socket programming in JAVA...???
I m using byte array as packets and DataInputStream and DataOutputStream for reading and writing the packets.