I am having some difficulty sending an http get request to the server through a socket connection, downloading binary data located in a relative folder on the server and then writing it to a local file.
sock = new Socket(server, port);
in = new DataInputStream(sock.getInputStream());
out = new DataOutputStream(sock.getOutputStream());
String request = "GET /folder/folder/datafile HTTP 1.0\r\n\r\n";
//then i send the get request to the server
The problem is that I when i go to read the response from the socket into a byte array and write the bytearray to the file; the data either is not written at all (filesize is 0) or in some cases the data is partially written. Is there something I am doing wrong with the get request? Any comments would be appreciated. Thanks