menory allocted by the com port

  • Hello ,
    i have an problem with memory , allocated by the com port.
    in an function i send one byte of data to the com port and wait for one byte . but every time i receive on byte . some buffer is allocated . after an while the memory buffer becomes less , so an system error occured.

    this is the funktion , where buffer is allocated :

    1. int CComPort::ReadBytes(unsigned char *chBufferIn, int count)
    2. {
    3. DWORD bytes;
    4. int bResult=0;
    5. bResult=ReadFile(m_hPort,chBufferIn,count,&bytes,NULL);
    6. if (bResult==0) return 0;
    7. return bytes;
    8. }

    this is the setting of the timeouts:

    1. COMMTIMEOUTS commi;
    2. commi.ReadIntervalTimeout = 3;
    3. commi.ReadTotalTimeoutConstant = 100;
    4. commi.ReadTotalTimeoutMultiplier = 1;
    5. SetCommTimeouts(m_hPort,&commi);

    where could be an bug ?

    best regards

  • Hello,
    which HW do you use?
    Are you sure that there are no other functions called?
    Can you post project with sources please. Then i will check it.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.