You have mpointer in your for loop but increasing it at the same time in the for loop.
This will have undesired affects
Maybe change line 72 on the getmemblockbyte from mpointer to " i " instead
+ Code Snippet if sendingMemblock = 1
//SendSocketByte(conn, mPointer)
packSize = mPointer + 1000
if packSize > mSize then packSize = mSize-1
for i = mPointer to packSize. //***** Mpointer here
SendSocketByte(conn, getMemblockByte(m, mPointer)). // Change mpointer to i
t = getMemblockByte(m, mPointer) // not sure what this is doing in this for loop
inc mPointer // but increasing it here, remove ******
next i
flushSocket(conn)
if packSize = mSize-1
sendingMemblock = 0
//SendSocketString(conn, "END")
//flushSocket(conn)
endif
endif
To
+ Code Snippet if sendingMemblock = 1
//SendSocketByte(conn, mPointer)
packSize = mPointer + 1000
if packSize > mSize then packSize = mSize-1
for i = mPointer to packSize.
SendSocketByte(conn, getMemblockByte(m, i))
t = getMemblockByte(m, i ) // I'm not sure what this is doing you don't use " t " in your full snippet
next i
flushSocket(conn)
if packSize = mSize-1
sendingMemblock = 0
//SendSocketString(conn, "END")
//flushSocket(conn)
endif
endif
Programming 1 o 1
We shouldn't increase a value that is embedded in a for loop
and increase inside a for loop cause it will just skip values left right and centre and produce undesired results.
Maybe you just probably missed that.
To test the send byte - maybe test that command by sending a few single bytes manually to prove if that command works or not.