Hi Guys,
My first post here, hopefully not difficult a question I hope.
I have just tried the following code example. Sending from my phone to laptop (both are wifi) works perfectly. Sending from PC to phone, I get no msgbox popup. I looked at what wireshark thought it was doing (first on port 8000, then 5000)
Could my phone be refusing the connection attempt? (I had previously tried 1000 & 1001 because I already had some test software on those, same thing)
Port 8000
844 66.106174000 192.168.1.75 192.168.1.87 UDP 53 Source port: 62663 Destination port: irdmi
845 66.110363000 192.168.1.87 192.168.1.75 ICMP 81 Destination unreachable (Port unreachable)
Port 5000
1563 121.017658000 192.168.1.75 192.168.1.87 UDP 53 Source port: 62663 Destination port: 5000[Malformed Packet]
1564 121.021770000 192.168.1.87 192.168.1.75 ICMP 81 Destination unreachable (Port unreachable)
My first post here, hopefully not difficult a question I hope.
I have just tried the following code example. Sending from my phone to laptop (both are wifi) works perfectly. Sending from PC to phone, I get no msgbox popup. I looked at what wireshark thought it was doing (first on port 8000, then 5000)
Could my phone be refusing the connection attempt? (I had previously tried 1000 & 1001 because I already had some test software on those, same thing)
Port 8000
844 66.106174000 192.168.1.75 192.168.1.87 UDP 53 Source port: 62663 Destination port: irdmi
845 66.110363000 192.168.1.87 192.168.1.75 ICMP 81 Destination unreachable (Port unreachable)
Port 5000
1563 121.017658000 192.168.1.75 192.168.1.87 UDP 53 Source port: 62663 Destination port: 5000[Malformed Packet]
1564 121.021770000 192.168.1.87 192.168.1.75 ICMP 81 Destination unreachable (Port unreachable)
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.1.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