Using SNC from Joshy in a project.
But I am trying to eliminate long "waiting" delays.
Normally in my programs I break all the time consuming tasks up into steps.
Pseudo code.
Code: Select all
Sub DoTasks
Select Case StepNbr
Case 1
var client = NetworkClient(ServerIP,ServerPort)
var connection = client.GetConnection()
StepNbr += 1
Case 2
If connection->CanPut() = 1 Then
Status = connection->PutData(StrPtr(TxData),Len(TxData))
StepNbr += 1
EndIf
Case 3
If connection->CanGet() Then
nBytes = connection->GetData(buffer)
' etc
StepNbr += 1
End If
Case 4
'Crunch up the Data received.
End Select
End Sub
BUT, to do the above, the Client & Connection var's are not visible in the following cases.
So I get the error that they are not defined.
So, the other solution is to declare the var's at the start of the program.
var shared client = NetworkClient(ServerIP,ServerPort) and then just referring to
the client in the DoTasks Sub.
Then I get really weird errors.
Using FreeBASIC Compiler - Version 1.06.0 (02-17-2019), built for linux-x86_64 (64bit)"/usr/local/bin/fbc" -b "/home/barfresh/projects/TPLink/tplink.bas" -v
/home/barfresh/projects/TPLink/tplink.c: In function ‘_GLOBAL__I’:
/home/barfresh/projects/TPLink/tplink.c:1335:2: error: stray ‘\20’ in program
__builtin_memset( &~O, 0, 24ll );
^
/home/barfresh/projects/TPLink/tplink.c:1335:2: error: stray ‘\1’ in program
/home/barfresh/projects/TPLink/tplink.c:1335:23: error: ‘O’ undeclared (first use in this function)
__builtin_memset( &~O, 0, 24ll );
^
/home/barfresh/projects/TPLink/tplink.c:1335:23: note: each undeclared identifier is reported only once for each function it appears in
/home/barfresh/projects/TPLink/tplink.c:1336:2: error: stray ‘\20’ in program
FBSTRING* vr$2 = fb_StrAssign( (void*)&~O, -1ll, (void*)"192.168.1.145", 14ll, 0 );
^
And lots more.
It looks like it never even got to call the compiler.
Can someone please shed some light on this or suggest an alternate approach.
Regards