Virtual Port close before full data receive.(Read 11366 times)
Virtual Port close before full data receive. on: September 24, 2013, 10:07:28 AM
I am using Eltima Virtual Port in my program.
Some weird thing happen on my co-worker machine.

For eg, we send a receipt from a POS system to virtual port. The receipt look like split into 2 separate byte.
Eg: 958 bytes was split into 948 bytes & 10 bytes.
This error does not happen to my development machine.

After checking the log file, i suspect that the virtual close event trigger before full receipt captured.

   Private Sub AxVSPortAx1_OnRxChar(ByVal sender As Object, ByVal e As AxVSPortLib._IVSPortAxEvents_OnRxCharEvent) Handles AxVSPortAx1.OnRxChar
        Dim Buff() As Byte
        Dim ReceivedCnt As Long

            Buff = AxVSPortAx1.ReadArray(e.count)
            ReceivedCnt = UBound(Buff) + 1

            If ReceivedCnt <> 0 Then
                RTReceipt.Text = System.Text.ASCIIEncoding.UTF8.GetString(Buff)

            End If
    End Sub

Re: Virtual Port close before full data receive. Reply #1 on: September 24, 2013, 01:37:23 PM
A serial port is essentially a streaming device: there is no beginning or end of transmission. No matter how much data has been written to the port, you'll be able to read only as much data as has been received until the moment you are reading it.


Sitemap 1 2 3 4 5