locked
SerialPort write, flush RRS feed

  • Question

  • Hi,

    I've noticed that the System.IO.Ports.SerialPort class sends data if and only if the write buffer inside the class is full. I'd like to know whether there is a way of flushing the buffer immediately after Write. My application sends just a few bytes of data and I need my connected device to be able to react as soon as possible. I tried using SerialPort.BaseStream.Flush but had no luck, I always receive chunks 2048 bytes long.

    I use Visual Basic 2005 Express.

    Thanks in advance
    Wednesday, July 9, 2008 8:19 PM

Answers

  • i use 2008 and have not noticed that to be the case.  check writetimeout.  set it to 1 and see if that helps, or leads you somewhere else.
    dewayne the pain
    Wednesday, July 9, 2008 11:40 PM

All replies

  • i use 2008 and have not noticed that to be the case.  check writetimeout.  set it to 1 and see if that helps, or leads you somewhere else.
    dewayne the pain
    Wednesday, July 9, 2008 11:40 PM
  • Hi Eosie,

    Please look through this excellent document:
    http://www.innovatic.dk/knowledg/SerialCOM/SerialCOM.htm
    Serial COM Port Communication with Visual Basic .NET

    Thank you dbasnett for your friendly help. :-)

    Best regards,
    Martin Xie
    Thursday, July 17, 2008 2:18 AM