I need some assistance in making the following code work as a random access random record size read and write chunck or fixed width read and write if you will.
Spent a couple of hours reading many posts in the forum, with many coffees LOL, but not sure why I am getting a syntax error on the if and end end if statements.......... any ideas ?
Basically I am writing a zmodem crash recovery protocol to transfer image file data over a tcp-ip socket. Cannot use ftp must be done with this type of implementation as b4x data packets arrive out of sequence in the astreams new data event. (widely documented)
If anyone can see issues, please let me know the correct way.
Thanks
Spent a couple of hours reading many posts in the forum, with many coffees LOL, but not sure why I am getting a syntax error on the if and end end if statements.......... any ideas ?
Basically I am writing a zmodem crash recovery protocol to transfer image file data over a tcp-ip socket. Cannot use ftp must be done with this type of implementation as b4x data packets arrive out of sequence in the astreams new data event. (widely documented)
If anyone can see issues, please let me know the correct way.
Thanks
B4X:
Dim aaa As String
Dim RAF As RandomAccessFile
Dim b() As Byte
Dim x() As Byte
TXRec = Rec ' record number
RAF.Initialize(File.DirInternalCache, fName, True)
RAF.CurrentPosition = Rec
If RAF.Size - (RAF.CurrentPosition + 4096) => 4096 Then ' <------ this line throws syntax error in logs window
x = RAF.ReadBytes(b, 0, 4096, TXRec)
TXRec = TXRec + 4096
aaa = BytesToString(x, 0, x.Length, CharSet)
SendIt(18550, Pad(fName,20,0) & aaa) 'this handles the encryption, checksums etc and sends the data
End If ' <------ this line throws syntax error in logs window
If RAF.Size - (RAF.CurrentPosition + 2048) => 2048 Then
x = RAF.ReadBytes(b, 0, 2048, TXRec)
TXRec = TXRec + 2048
aaa = BytesToString(x,0,x.Length,CharSet)
SendIt(18550, Pad(fName,20,0) & aaa)
End If
' '''''''
' '''''''
If RAF.Size - (RAF.CurrentPosition + 1) => 1 Then
x = RAF.ReadBytes(b, 0, 1, TXRec)
TXRec = TXRec + 1
aaa = BytesToString(x,0,x.Length,CharSet)
SendIt(18550, Pad(fName,20,0) & aaa)
End If
If RAF.Size - (RAF.CurrentPosition + 1) > RAF.Size Then
SendIt(18551, Pad(fName,20,0))
End If
'End If
RAF.Close