I try to create a simple app to connect and send data. But, the connection must be created in the "send-data" function, if this is still not active.
(pseudocode)
B4X:
sub senddata()
if SocketStateVariable = 0 then
socket.connect(...)
do until SocketStateVariable = 1
doevents
loop
end if
socket.senddata
end sub
Well .. the problem is, that i never come out of the do-loop. I waiting for a value change of a SocketStateVariable. this value will change btw. set to 1 on "socket_connected()" event. But, this event looks never called while i'm in the do loop.
I use AsyncStreams for read and write ... but, i think thats the socket use a seperat thread, so that he can call the event and i can set the var to check the state. But, ok .. then i must do this on another way.