Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Gai" of GaiException & EAI stand for / mean?

Tags:

android

There's no javadoc. Can anyone help explain what exactly the "Gai" of GaiException means? As well as "EAI"?

https://android.googlesource.com/platform/libcore/+/cff1616012dc0d56c2da9af2b9b1183e76c7e044/luni/src/main/java/libcore/io/GaiException.java

https://android.googlesource.com/platform/external/okhttp/+/abe10a6415358d66bb0d1ac3145c8909a327a54d/src/main/java/libcore/io/OsConstants.java

like image 307
McNinja Avatar asked Jun 12 '15 13:06

McNinja


1 Answers

Lines 22-27 of the GaiException.java file state the following:

/** An unchecked exception thrown when the {@link Os} {@code getaddrinfo} or {@code getnameinfo} * methods fail. This exception contains the native error value, for comparison against the * {@code GAI_} constants in {@link OsConstants}, should sophisticated * callers need to adjust their behavior based on the exact failure. */

Based on the wording @code getaddrinfo, it looks like it means Get Address Information.


OS Interface

The getaddrinfo method is defined in the Os.java interface file on line 50:

public InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException;


OS Interface Implementations

The getaddrinfo method is then implemented (via the Os interface) in ForwardingOs.java on line 59:

public InetAddress[] getaddrinfo(String node, StructAddrinfo hints) throws GaiException {
    return os.getaddrinfo(node, hints);
}

The functionality from ForwardingOs.java is then inherited by the BlockGuardOs.java class (and is not overidden)

like image 183
Jamie Avatar answered Sep 19 '22 01:09

Jamie