Have successfully created an app with B4A, but wondering if there is sample code to do this with B4i. Here is part of what we've done with B4A:
Would appreciate any help, before I spend 3 weeks and then figure out that it can't be done with B4i.[/code]
B4X:
Sub Socket1_Connected(Connected As Boolean)As Boolean
If Connected = True Then
ToastMessageShow("Connected",True)
lblMsg.Text="Connected!"
Main.AStreams.Initialize(Main.Socket1.InputStream,Main.Socket1.OutputStream,"Astreams")
Else
ToastMessageShow("Server not available",True)
lblMsg.Text="Server not available"
btnConnect.Text = "Connect"
End If
btnConnect.Enabled = True
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim msg As String
Dim cMsg As String
Dim unsignedi As Int
Dim signedb As Byte
msg = BytesToString(Buffer, 0, Buffer.Length, "ASCII")
Log(msg)
For i = 0 To msg.Length -1
signedb = Buffer(i)
unsignedi = Bit.AND(0xff, signedb)
cMsg = cMsg & Chr(unsignedi)
Next
Log(cMsg)
lblMsg.Text = x & " / " & msg.Length & " - " & msg
End Sub
Sub SendData(msg As String)
Dim Buffer() As Byte
Buffer = msg.GetBytes("UTF8")
Main.AStreams.Write(Buffer)
Main.AStreams.Write(Array As Byte(254))
End Sub
Would appreciate any help, before I spend 3 weeks and then figure out that it can't be done with B4i.[/code]
Last edited: