0

仮想シリアルポートを介して大きなファイル(任意のタイプ)を送信する方法を知りたいと思っていました。私は現在これを持っています:

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 バイトしか取得できません。可能なすべてのバイトを送信できるようにするにはどうすればよいですか?

4

0 に答える 0