byte parse?

Jaames

Active Member
Licensed User
Longtime User
Hi !

If someone can help me to convert this peace of code from VB.NET to B4A please:

B4X:
'Note: 'password' and 'rconCommand' are a string value outside from this function
        Dim command As String
        command = "rcon " & password & " " & rconCommand
        Dim bufferTemp() As Byte = Encoding.ASCII.GetBytes(command)
        Dim bufferSend(bufferTemp.Length + 5 - 1) As Byte

        'intial 5 characters as per standard
        bufferSend(0) = Byte.Parse("255")
        bufferSend(1) = Byte.Parse("255")
        bufferSend(2) = Byte.Parse("255")
        bufferSend(3) = Byte.Parse("255")
        bufferSend(4) = Byte.Parse("02")
        Dim j As Integer = 5

        For i As Integer = 0 To bufferTemp.Length - 1
            bufferSend(j) = bufferTemp(i)
            j += 1
        Next i

It is byte that i need to send over the UDP but no luck to accomplish this in b4a.
I just need byte array as in example above but don't know how to do that ...

Thanks in advance
 
Top