Not needed and is a mistake:
CallSub2("","Connect", General.WifiIpAdress)
'Change to:
Connect(General.WifiIpAdress)
Not exactly sure what you are doing but it looks like you need to use B4XBytesBuilder from B4XCollections.
There are many mistakes in the code flow. Start with this tutorial:
[B4X] Resumable subs that return values (ResumableSub)
That is what I had before but it was one of the tests of I could let the code wait with the callsub or callsubdelayed command. This all did not work. I was confused with another part. Sorry. But this is only to connect and it worked. I thought there was no difference between
connect(general.wifiadress)
and
callsub2("","Connect",general.wifiipaddress)
Making the connection is not the problem. Sending up and down 1 block of information also works good.
I read the resumable susbs part but it did not help solving my problem of letting the code wait for a response.
PS, there is no serialiser or anythign needed to send thsi code. I just need to send osme bytes, and I will get an asnwer of several bytes back..
PPS, I did try also a wait for with a resumable sub (for the Wifiastream_NewData) and a return value but but this did not let the command wait either for a return anwer.
PPS. This is only for when I have this working, but of course there must be a way to timeout the wait for command while when there is no answer, the programm must not get stuck...