Serial Port Reader

Joined
Jan 28, 2009
Messages
9
Location
AZ
Programming Experience
Beginner
I been experimenting with the Serial Port Reader in VB 2005 and I have had success reading and streaming binary data but I dont know how to properly buffer and control my thread. The reason I know this is because when I save the incoming binary data and look it over using winhex i can see that their is missing data or extra data in my packets. Any experienced programmers have any suggestions or good places to look on how to work a buffer? :eek:
 
Hello.

How to you write and receive the data? There have been many postings lately which regarded such issues, some of them were solved by setting the right Encoding in the SerialPort class, or using the methods:
VB.NET:
Public Sub Write(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer)
Public Function Read(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer) As Integer

Best Regards,
Bobby
 
Dim port As SerialPort = New _
System.IO.Ports.SerialPort("COM1", 4800, Parity.None, 8, StopBits.One)

I use this method and I think I got my problem figured out I needed to use Threading but I also needed to clear my port buffer.
 
Back
Top