Page 1 of 1

Read Serial Port Buffer in one go

Posted: Mon Sep 04, 2006 4:40 pm
by globalvision
This is the code which reads one character and waits 5 seconds:

Dim Res As String = COM.Read(1, 5000)

What do we have to do to read entire input buffer in one go and no waiting? We dont want to use events.

Regards
[:I]

RE: Read Serial Port Buffer in one go

Posted: Mon Sep 04, 2006 4:51 pm
by johan
Port.BufferSize will return the number of bytes in the input buffer. You can use this argument in a Port.Read() to read all data.

If you can make a loop to read data with a short timeout, e.g. 1 milisec, until Port.Read() returns Null.

Regards,
Johan

Franson Support