Thank you so much for following up on this. I'm not exactly sure what I used, here's a code snippet that I adapted from the sample code.
StreamScanRequest scan = requestManagerObj.CreateStreamScanRequest(Policy.DEFAULT);
scan.Start(fileName, fileName);
byte[] buffer = new byte[16 * 1024];
using (FileStream fileStream = ... ) {
int read = 0;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {
scan.Send(read < buffer.Length ? buffer.Take(read).ToArray() : buffer);
fileStream.Write(buffer, 0, read);
}
ScanResult result = scan.Finish(fileStream);
}
I guess it's not since the scan won't start until after the file stream finished.
Is there a C# ICAP client example? The latest I can find is back in 2007. While I manage to make it work, it's extrememly slow. A 50M pdf takes 1:37, while ssecls.exe took 5 seconds. Is there a more uptodate example? Thanks.
http://vaibhavkulkarni.wordpress.com/2007/11/19/a-icap-client-code-in-c-to-virus-scan-a-file-using-symantec-scan-server/
P.S.
After some further reading, it seems StreamScan is using ICAP underneath, but I don't have control over the streaming process. The send for scanning process won't start until upload finishes, even though I try to pass the stream around.
Speed wise, the low level ICAP client has the same extreme slow speed as scan.Finish(fileStream). If I use scan.Finish(Stream.null), it gest a little faster. But everything is magintude below ssecls.exe
I was hoping there's a way to stream Web=>Service=>Scanner=>FileSave synchronously, at reasonable speed, so the UI progress keep up with all the backend process.
Thanks.