Problem With Close

  • nicolas

    nicolas - 2012-12-13


    I use the library from many years. :)
    I use it for send and receive textfile. I use Moxa materiel for have a Serial Port (Moxa 5110) (it has a buffer)
    When, for any reasons, i have a problem on the middle of the transfer (for exemple in a RTS/CTS mode) and i try to Close the COM port it take 30 sec to close the port and freeze my application during this time.
    So when i have Character on the moxa buffer and i try to close the port it take too many time.

    Anybody have a explaination on that problem?

    Thank's for advance.

  • nicolas

    nicolas - 2012-12-14

    it's the PurgeComm() methode in the ClearBuffer() method that do not her job.

    In fact When clearbuffer is called the buffer is not flushing…

    Any idea?


  • Warren

    Warren - 2012-12-14

    The failure of PurgeComm to function is a fact that you have to learn to live with when you use certain brands of USB to Serial converters. I have not had this problem with a physical PCI serial port.  These days people use USB to Serial converters and forget that there is a lot of custom magic involved in those.  

    If it is annoying you, buy a different convertor that uses a different chipset.  My favorite is the FTDI chipset.  I buy cheap $5 ones from my local PC "bone shop" that imports them directly from somewhere in Asia, and when I find the FTDI ones, I stock up so I always have enough of them.

  • nicolas

    nicolas - 2012-12-14

    Thank's for your response.

    But it's not a USB to Serial, It's an expensive industrial ethernet to serial material :) I hate the USB to serial converters indeed ;)

    So have you any idea about this problem with this material? It's only a constructor fact or can be a Programming way in my code?


Log in to post a comment.