简体   繁体   English

将客户端通过RMI发送的服务器值存储在服务器中

[英]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 是否可以在服务器中存储客户端通过远程方法调用(RMI)进程发送的值

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 . 客户端到达类IVote来调用方法IVote vote(int id, int candidate) ,该方法设置了一个布尔变量hasVoted ,该变量检查投票者是否已投票为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 ? 有可能用RMI做到吗?

My partners told me we could only do it with TCP. 我的合作伙伴告诉我,我们只能使用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. 这只是一些普通的Java代码。 All RMI does is transport the arguments and return values. RMI所做的只是传输参数和返回值。

Your partners are seriously misinformed. 您的伙伴被严重误导了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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