Bug? UDPPacket.HostAddress is missing

Network 1.10 libary UDPPacket.HostAddress is missing and UDPPacket.Host return incorrect host name

  • UDPPacket.HostName will get a compile error

    Votes: 1 100.0%
  • UDPPacket.Host will often get invalid host name

    Votes: 0 0.0%

  • Total voters
    1
  • Poll closed .

Sonofpeace

New Member
Licensed User
Longtime User
Network Lib 1.10 Document said that:

19.png
Host As String [read only]
This method is deprecated and will not work properly on Android 4+ device.

Use HostAddress instead.
19.png
HostAddress As String [read only]

Gets the IP address of the sending machine.


In fact, I can't find HostAddress. Host is still there and it worked not always correct
Sub Activity_Create(FirstTime As Boolean)

for B4A UDP Sample:

Sub UDP_PacketArrived (Packet As UDPPacket)
Dim msg as string
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
Msgbox("Received msg [" & msg & " ] from Host:" & Packet.HostAddress & " Port:" & Packet.Port ,"Debug")
Return
End Sub

If you use Packet.HostAddress, it'll compile error-- HostAddress is not existed at all.
If you use Packet.Host you'll get incorrect host name very often (My Tablet is Google Asus NEXUS 2 Android 4.3)

Wewe
 

Sonofpeace

New Member
Licensed User
Longtime User
Hi Erel,

1. Current version Network Library is Network 1.10
UDPPacket doesn't contain 'HostAddress' member.
It's still 'Host' which return incorrect Host name of UDP sender.
2. My application needs to response incoming UDP packet from a remote UDP sender.
So I need to examine HostAddress to get remote IP and reply a message

Wewe
 

Sonofpeace

New Member
Licensed User
Longtime User
Dear Erel,

Thank you for great help.
I am studying UDP communication and overwrite original version(1.25) accidently with an old version(1.10) downloaded from B4A Web site.
Sorry for that.

Wewe
 
Top