The lenght coming from socket varies for each request. The data coming from socket is binary data. I am using the following code and it taking more than 45 seconds to read the binary data. How do I read the data fast? Any help on how to read the binary data fast from socket ?
It's a bad idea to use a Reader to read binary data. Readers are used to read encoded text and will trim the data to match the default encoding. As for the amount of time to move data, that depends on how much you are moving and the speed of your connection. There's good information on improving IO throughput in the Java Platform Performance online book.