FIcmp::IcmpEcho do not work Android

I want to ping to AWS endpoint, and measure response time.

So I put on this code, editor & windows application is working, but android is not working.

Always android responsed “TimeOut”.

This is my testing mobile information.

“Galaxy note 8(Android 7.1.1)”.

Question:

  • How to use “FIcmp::IcmpEcho” for android? and iOS?
  • Is there any ping method more simply except “FIcmp::IcmpEcho”?

I put it for other method “FUDPPing::UDPEcho”, but it does’nt work too.

Code:

void UAWSManager::GetLatency()
{
    PingReult.BindUObject(this, &UAWSManager::OnPingReply);
    //FUDPPing::UDPEcho(Endpoint, 20.0f, PingReult);
    FIcmp::IcmpEcho(Endpoint, 20.0f, PingReult);
}

void UAWSManager::OnPingReply(FIcmpEchoResult Result)
{
    PingReult.Unbind();
    switch (Result.Status)
    {
    case EIcmpResponseStatus::Success: // windows come here
        break:
    case EIcmpResponseStatus::Timeout: // android come here
        break:
    }
}

thanks for your code, it’s help a lot. I’m trying to use it in static functions but without success.

Have same issue, I get stuff like:

08-08 10:53:34.304   916   916 E audit   : type=1400 audit(1565286814.289:11481): avc:  denied  { read } for  pid=15300 comm="Thread-5" name="stat" dev="proc" ino=4026532108 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_stat:s0 tclass=file permissive=0 SEPF_SM-G950U1_8.0.0_0011 audit_filtered
08-08 10:53:34.304   916   916 E audit   : type=1300 audit(1565286814.289:11481): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffff9c a1=718de0dd70 a2=0 a3=0 items=0 ppid=936 pid=15300 auid=4294967295 uid=10234 gid=10234 euid=10234 suid=10234 fsuid=10234 egid=10234 sgid=10234 fsgid=10234 tty=(none) ses=4294967295 comm="Thread-5" exe="/system/bin/app_process64" subj=u:r:untrusted_app:s0:c512,c768 key=(null)

On Android, socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) in IcmpPosix.cpp, will not receive IP header, so the “PacketHeader = reinterpret_cast<struct icmp*>(ResultBuffer + IpHeaderSize);” just got the wrong offset.

I’ve made a pull request to fix IcmpEcho on Android, and add support for iOS.
https://github.com/EpicGames/UnrealEngine/pull/10789

1 Like