How To...
/**
     * Get the IP address of the Tivo that is connected. This does not come from
     * the context "Host" attribute, since that is the host serving this app,
     * not the Tivo. This is gathered from the Context's socket. Retrieved via
     * the public getSocket method which exists in the HME sample host's
     * HostContext class. If your host is using a different class that doesn't
     * have that method, then this will return null.
     */
    public String getHostAddress() {
        //per http://www.tivocommunity.com/tivo-vb/showthread.php?t=337246
//        return ((com.tivo.hme.host.sample.HostContext)getApp().getContext() ).getSocket().getInetAddress().getHostAddress();
 
        // make work with more possible classes
        Socket socket;
        try {
            socket = (Socket)getMethodResult( getApp().getContext(), "getSocket" );
        } catch(IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        } catch(SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        } catch(IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        } catch(NoSuchMethodException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        } catch(InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
 
        return socket.getInetAddress().getHostAddress();
    }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License