• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

java RMI: getting the client address

Desova

Limp Gawd
Joined
Jun 24, 2002
Messages
467
i'm trying to figure out how to get the rmi server to tell me the host address of the client thats using it, for reporting & security purposes.

the java.rmi.server.RemoteServer class has a method called .getClientHost()
but all my code is in an implimentation class which uses a custom interface which extends the java.rmi.Remote interface, which is somehow linked to the java.rmi.server.UnicastRemoteObject which extends the java.rmi.RemoteServer class which is the one i'm wanting to call the method from.

so i'm sure you can see my confusion :)

this is my interface so far:
Code:
import java.rmi.*;

public interface FileService extends Remote{

	public Listing listFiles() throws RemoteException;
	public byte[] getFile(String filename) throws RemoteException;
	public boolean uploadFile(byte[] filedata, String filename) throws RemoteException;
	public boolean renameFile(String oldname, String newname) throws RemoteException;

}

but i dont think the rest of the code is particularly relevant, i'll add it if anyone thinks it'll help though.

so any ideas how i can figure out the clients host?
 
Well, like I said previously, I never worked with RMI before. But looking at the API, .getClientHost() is a static method. So why would it be more complicated then simply calling RemoteServer.getClientHost() in your code?

Hope I got the correct answer :cool:
 
i tried that before and it didnt work. then i realised i forgot to import java.rmi.server.*; :(

now i need to get it to work non remotely.
 
Back
Top