简体   繁体   中英

Storing in a server values sent by a client through RMI

Is it possible to store in a server the value sent by a client through Remote Method Invocation (RMI) process

I am doing a client that can call to a server and run the methods the last one published on the Registry.

These methods are made to create an electronic voting system. Client reach a class IVote to call for a method vote(int id, int candidate) which set a boolean variable hasVoted that checks if the voter has already voted to true .

public int vote(int idv, int candidat)throws RemoteException
    {
            if(!hasVoted)
            {
                hasVoted = true;
            return candidat;
            }
    } 

I would like to create a counter on the server side that counts for the candidates remotely chosen by voters. Is it possible to do it with RMI ?

My partners told me we could only do it with TCP. I am puzzled as far as those values actually goes to a computer and are stored to process the method.

Of course it's possible. It's just some ordinary Java code. All RMI does is transport the arguments and return values.

Your partners are seriously misinformed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM