On Mon, 14 Mar 2005, John Giammarche wrote:
Hello everyone and thanks for reading my message.
I want to use clamd to scan files that are uploaded to a Java Servlet. So far, I've connected to clamd and clamd answered the PORT that I should connect to send the file. So far so good.
When I connect to that port and send the data (raw, as a byte array), clamd never answers. The questions here are:
1- In which port does clamd answer? I assume it's the same one through which I sent the file. I want to read the answer to know if the file is infected or not.
No, clamd actually answers once you close the connection on the data socket. It answers on the original port you connected to. It says stream: OK if it's ok or stream: <virus-name> FOUND if there's a virus...
2- I comnfigured the logging so that it logs clean files also. Look at the log so far:
Close the connection on the temporary data socket and read a line from the control socket (the original one you connected to) and you should get stream: OK/FOUND messages. I think your problem was you were expecting it to return an answer on the data connection right away, but of course it couldn't, as it never knows when the stream is done. It kept waiting for more data. But your java program wanted to get a reply. Both sides were waiting for something and noone was talking. The only way to tell clamd you are done sending it data is to actually close the connection on the data socket. Then you get an answer right away on the control socket.
-Calin _______________________________________________ http://lurker.clamav.net/list/clamav-devel.html