Hello
I want to control two LEDs by connecting UDP to two seekbars. But I do not know what command to use to send values so that each LEd is controlled separately.
The code I wrote sends values with the udp protocol, but because the values sent are the same name, both LEDs are controlled by changing a seekbar. How can I send a name along with the sent bytes so that the recipient of the message notices the seekbar change.
My code is as follows:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I want to control two LEDs by connecting UDP to two seekbars. But I do not know what command to use to send values so that each LEd is controlled separately.
The code I wrote sends values with the udp protocol, but because the values sent are the same name, both LEDs are controlled by changing a seekbar. How can I send a name along with the sent bytes so that the recipient of the message notices the seekbar change.
My code is as follows:
			
				B4X:
			
		
		
		#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals
    
    Dim server As UDPSocket
    
    
End Sub
Sub Globals
    
    Private IP As EditText
    Dim s1 As ServerSocket
    Private SeekBar1 As SeekBar
    Private Label2 As Label
    Private SeekBar2 As SeekBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
    
    Activity.LoadLayout("1")
    server.Initialize("server",12000,300)
    Activity.Title=s1.GetMyIP
    
End Sub
Sub server_PacketArrived (Packet As UDPPacket)
    
    Label2.Text=(BytesToString(Packet.Data,0,Packet.Length,"utf-8"))
    
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
    Dim b1 As ByteConverter
    Dim b2 As String
    b2 = SeekBar1.Value
    Dim p4 As UDPPacket
    p4.Initialize(b1.StringToBytes(b2,"utf-8"),IP.Text,12000)
    server.Send(p4)
    
    
    
    
End Sub
 
Sub SeekBar2_ValueChanged (Value As Int, UserChanged As Boolean)
    Dim b1 As ByteConverter
    Dim b2 As String
    b2 = SeekBar1.Value
    Dim p5 As UDPPacket
    p5.Initialize(b1.StringToBytes(b2,"utf-8"),IP.Text,12200)
    server.Send(p5)
End Sub