This code appears to be the same for B4i and B4A. Not sure what's the best way to go about this. I have buttons on my app and each one represents a number. What I'd like to do is determine what button was pushed and then send the data. It seems like I must at least do this:
.....and so on. Instead of putting this in each sub:
Is there a way to handle the button pushes and put the code above in a separate area? I know I can put it here
but sometimes more data will be sent without closing the connection so the client_connected sub work.
In verbose terms, I want to determine what button was pushed and then have one area where the data is sent.
Also, I have a question about prefix mode. Both side of the communication are controlled by my app and the instructions say to put a header with the amount of bytes in the packet. Is it as simple as:
I looked at the example here:
https://www.b4x.com/android/forum/threads/asyncstreams-tutorial.7669/
but didn't see where to add the header.
B4X:
sub button1_click
Buffer = 1
end sub
sub button2_click
Buffer = 2
end sub
sub button3_click
Buffer = 3
end sub
.....and so on. Instead of putting this in each sub:
B4X:
buffer = sNewLine.GetBytes("UTF8")
AStreams.Write(buffer)
Is there a way to handle the button pushes and put the code above in a separate area? I know I can put it here
B4X:
Sub Client_Connected(ConStatus As Boolean)
In verbose terms, I want to determine what button was pushed and then have one area where the data is sent.
Also, I have a question about prefix mode. Both side of the communication are controlled by my app and the instructions say to put a header with the amount of bytes in the packet. Is it as simple as:
B4X:
7"testing"
I looked at the example here:
https://www.b4x.com/android/forum/threads/asyncstreams-tutorial.7669/
but didn't see where to add the header.