在VB.NET中通过虚拟串口发送大文件

时间:2013-07-24 19:13:01

标签: vb.net serial-port virtual

我想知道如何通过虚拟串口发送大文件(任何类型)。我目前有这个:

Dim oFile As System.IO.FileInfo = New System.IO.FileInfo("largepic.jpg")
    Dim numBytes As Long = oFile.Length

    Dim fStream As New FileStream("largepic.jpg", FileMode.Open, FileAccess.Read)

    Dim br As New BinaryReader(fStream)
    Dim dataVals As Byte() = br.ReadBytes(CInt(numBytes))

    br.Close()
    fStream.Close()

    Dim myserialport As New SerialPort("COM10", 9600, Parity.None, 8, StopBits.One)

    If myserialport.IsOpen = False Then
        myserialport.Open()
    End If

    myserialport.Write(dataVals, 0, dataVals.Length)

但是,当我尝试用另一个应用程序读取串行端口时,我最多只能获得4096个字节。如何制作它以便我可以发送所有可能的字节?

0 个答案:

没有答案