Udp Chat Problem

AndyRuleZ

New Member
Hi, i'm trying to send a string from the smartphone to the pc. Please help me to get those strings in vb or in autoit.

Here's the code:
B4X:
Sub process_globals
    Dim UDPSocket1 As UDPSocket
End Sub

Sub Globals

End Sub
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        UDPSocket1.Initialize("UDP", 0, 8000)
    End If
    Dim Packet As UDPPacket
    Dim data() As Byte
    data = "Hello from Android".GetBytes("UTF8")
    Packet.Initialize(data, "192.168.2.100", 5000)
    UDPSocket1.Send(Packet)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
    Dim msg As String
    msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
    Msgbox("Message received: " & msg, "")
End Sub

Problem: I tried to script some udp chats with vb and autoit, but i didn't receive any strings. It works with this application:
 

Attachments

  • NetUDPserverDemo.zip
    18.6 KB · Views: 323
Top