如何通过Sockets发送和接收Java对象? [英] How to send and receive Java objects over Sockets?
问题描述
我正在编写一个具有客户端和服务器的并发ATM应用程序。
I'm coding a concurrent ATM application having a Client and a Server.
我需要知道如何使用Socket编程来调用Server方法请求其当前余额,转移资金等),并将对象返回给客户。
I need to know how Socket programming can be used in this to call Server methods (request for his current balance, transfer funds etc) and get Objects returned to Client.
我不想只是使用System.out.println传递文本,如课程:所有关于套接字
I do not want just to pass text using System.out.println like mentioned in Lesson: All About Sockets
推荐答案
应该使用Javas RMI
Lib。
You should use Javas RMI
Lib for this.
你可以在这里找到一个小例子: http://download.oracle.com/javase/1.3/docs/guide/rmi/getstart.doc。 html
You can find a small example here: http://download.oracle.com/javase/1.3/docs/guide/rmi/getstart.doc.html
这篇关于如何通过Sockets发送和接收Java对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!