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: Wendy J Bossons <wbossons_at_nospam>
Date: Thu Nov 04 2010 - 18:02:16 GMT
To: ClamAV users ML <>

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.

            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 =;
                    dataOutputStream.write(buffer, 0, read);
                } catch (IOException e){
                    log.error("Could not read/write to the socket . . . ");
            try {
            } catch (IOException e){
                log.error("Error writing zero-length chunk to socket") ;
Wendy Bossons
Senior Software Engineer
MIT Libraries
Software Analysis and Development
77 Masachusetts Avenue
Cambridge, MA 02139-4307

On Nov 4, 2010, at 12:15 PM, Trk Edwin wrote:

On Thu, 4 Nov 2010 11:50:40 -0400
Wendy J Bossons <wbossons@MIT.EDU<mailto:wbossons@MIT.EDU>> wrote:

Ok. I see. That's good -- it is clearer.

One question and this has been blocking my understanding as well --
when I scan a small pdf, I am getting this . . . INSTREAM: Size limit
reached, (requested: 4294967295, max: 25946112)

The file is the clam doc.

The default chunk size is 2048.

I am not sure why this would occur, or how to remedy it. Bumping this
number in the clamd.conf to 50xxxxxxxxxx does not get rid of the

Read the docs, you need to send the chunk's size, then the contents.

Run clamd with Debug yes in clamd.conf, it will give more details about
protocol errors.


Help us build a comprehensive ClamAV guide: visit