Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private btn_save_port As Button
Private localport As TextField
Private msgbox As Msgboxes
Private UDPSocket1 As UDPSocket
End Sub
Sub AppStart (Form1 As Form, Args() As String)
UDPSocket1.Initialize("UDP", 5000, 8000)
MainForm = Form1
MainForm.RootPane.LoadLayout("start") 'Load the layout file.
MainForm.Show
End Sub
Sub btn_save_port_Action
'restart socket with new Port
UDPSocket1.Close
UDPSocket1.Initialize("UDP",localport.Text,8000)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
Dim msg As String
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
msgbox.show("Message received: " & msg, "")
End Sub