clamav-users November 2010 archive
Main Archive Page > Month Archives  > clamav-users archives
clamav-users: Re: [Clamav-users] What is the overhead of opening

Re: [Clamav-users] What is the overhead of opening and closing sockets?

From: DJ Helmes <djhelmes_at_nospam>
Date: Fri Nov 05 2010 - 02:07:55 GMT
To: ClamAV users ML <clamav-users@lists.clamav.net>

Sent from my HTC Touch Pro2 on the Now Network from Sprint®.

-----Original Message-----
From: Wendy J Bossons <wbossons@MIT.EDU>
Sent: Thursday, November 04, 2010 6:08 PM
To: ClamAV users ML <clamav-users@lists.clamav.net>
Subject: Re: [Clamav-users] What is the overhead of opening and closing sockets?

Thank you for the help.

I found the issue. It had to do with needing to check the length of the read variable.

..\Wendy

Wendy Bossons
Senior Software Engineer
MIT Libraries
Software Analysis & Development
Building E25-131
77 Massachusetts Ave.
Cambridge, MA 02141-4307
Phone 617-253-0770
Fax 617-253-4462
wbossons@mit.edu<mailto:wbossons@mit.edu>
http://libraries.mit.edu

On Nov 4, 2010, at 2:34 PM, Török Edwin wrote:

On Thu, 4 Nov 2010 14:02:16 -0400
Wendy J Bossons <wbossons@MIT.EDU<mailto:wbossons@MIT.EDU>> wrote:

I have been sending the chunk size, and then its contents, but it
seems to be failing when the stream in question is of a pdf document.

Here is a sample . . . Is there something wrong? Why is it only the
pdf. Much larger html and jpg files that I've scanned succeed.

Run with 'Debug yes' and 'Foreground yes' in clamd.conf and paste the
output (the lines starting with $)

int read = DEFAULT_CHUNK_SIZE;
           byte[] buffer = new byte[DEFAULT_CHUNK_SIZE];
           System.out.println("The default chunk size is " +
DEFAULT_CHUNK_SIZE); // 2048 while (read == DEFAULT_CHUNK_SIZE){
               try {
                   read = inputstream.read(buffer);
            // WRITE TO THE OUTPUTSTREAM
                   dataOutputStream.writeInt(read);

what if read is 0? you'll write an end of strem marker then.

                   dataOutputStream.write(buffer, 0, read);
               } catch (IOException e){
                   setStatus(Curator.CURATE_ERROR);
                   log.error("Could not read/write to the
socket . . . "); }
           }
           try {
               dataOutputStream.writeInt(0);
               dataOutputStream.flush();
           } catch (IOException e){
               setStatus(Curator.CURATE_ERROR);
               log.error("Error writing zero-length chunk to

--Edwin

_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clam

[The entire original message is not included]
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml