Dear All,
Currently I am working in virus scanning in FS Service. So I am sending image file as well as the text files for the scanning. But the code works fine in the local but after deploying it to FS it hangs only for the Image file in the line ( while ( (tmp = responseReader.readLine()) != null && responseReader.ready())) please find the code below
socket = new Socket(VscanConstant.VIRUS_SCANNER_HOST, VscanConstant.VIRUS_SCANNER_PORT);
// send ICAP header
BufferedReader responseReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter output = new PrintWriter(socket.getOutputStream(), true);
// Socket time out
socket.setSoTimeout(1000 * 60 * 2);
output.println("RESPMOD icap://XXXXX.com:1344/interscan ICAP/1.0");
output.println("Host:XXXXX.com:1344");
output.println("Allow: 204");
output.println("Encapsulated: req-hdr=0, res-hdr=10", res-body=70"));
output.println("");
output.print"GET http://demo HTTP/1.1\n\n");
output.print("HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n\n");
output.println(Long.toString(bytes.length, 16));
int c;
fileIn = new ByteArrayInputStream(bytes);
Logging.logInfo("before sending the files to the server", LOGGER);
int count = 0;
while ((c = fileIn.read()) != -1)
{
count++;
output.write(c);
}
Logging.logInfo("count====>" + count, LOGGER);
fileIn.close();
output.println("");
output.println("0");
output.println("");
output.flush();
if (responseReader != null )
{
while ( (tmp = responseReader.readLine()) != null && responseReader.ready())
{
resultBuffer.append(tmp);
resultBuffer.append("\n");
}
}
Do you have any idea why its hanging in the BufferedReader ??