Hi, I am creating a simple video-chat with client developed in B4A and server in vb.NET. Now I should pass parameters to server-client and server-client from using the split but the function is reversed in the two environments. How can I do?
from vb.NET Example
from B4A Example
Thanks in advance
from vb.NET Example
B4X:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If Client.Available > 0 Then
Dim x(Client.Available - 1) As Byte
Stream.Read(x, 0, x.Length)
Dim text As String = UTF8.GetString(x)
Dim opt() As String
opt = Split(text, "|")
Select Case opt(0)
Case "770" 'lo stato
chat.Text = chat.Text & opt(1) & vbCrLf
Case "775" 'ricevo msg chat
chat.Text = chat.Text & opt(1) & vbCrLf
Case "772"
txtinput.Enabled = False
ch1.Checked = False
Case "780" 'CHANNEL CAM
' MsgBox("channel read!")
pView.Image = Image.FromStream(Stream) 'VIEW CAM!
End Select
End If
End Sub
from B4A Example
B4X:
Sub astreams_NewData()
Dim mbuffer() As Byte
Dim msg As String
If client.Connected = True Then
msg = BytesToString(mbuffer, 0, mbuffer.Length, "UTF8")
ToastMessageShow(msg, False)
Dim opt() As String 'attivo lo split del flusso
opt = Regex.Split("|", msg)
ToastMessageShow(opt, False)
Select Case opt(0) 'seleziono i vari casi
Case "771" 'apro la form della chat
ToastMessageShow("Chat è Attiva!", False)
Case "775" 'scrivo il testo inviato dal server
ToastMessageShow(opt(1), False)
End Select
End If
End Sub
Thanks in advance