简体   繁体   English

使用Java中的TCP套接字编程来验证帐号

[英]Validating an account number using TCP Socket programming in Java

I am kind of new to socket programming.That being said,I am not new to jAVA.I got a question.I need to write a program where I can use a client to provide an account number so that the server can retrieve information using that account number (of a bank). 我是套接字编程的新手。也就是说,我不是jAVA的新手。我遇到了一个问题。我需要编写一个程序,在其中可以使用客户端提供帐号,以便服务器可以使用以下方法检索信息:该(银行的)帐号。 My question: Can I put a few accounts in a hashmap or something and write a method inside the server to only fetch my account (if provided in the hashmap).In other words,no code needed.I will write that myself.Only trying to find an approach? 我的问题:我可以在哈希图中放置一些帐户,还是在服务器内部编写一个方法以仅提取我的帐户(如果哈希图中提供)。换句话说,不需要代码。我自己编写。寻找方法?

It sounds like Remote Method Invocation (RMI) would suit your needs. 听起来远程方法调用 (RMI)可以满足您的需求。 HashMap implements Serializable , so you would be able to send it directly to the server. HashMap实现Serializable ,因此您可以将其直接发送到服务器。

https://docs.oracle.com/javase/tutorial/rmi/overview.html https://docs.oracle.com/javase/tutorial/rmi/overview.html

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

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