Đang chuẩn bị liên kết để tải về tài liệu:
java programming language basics phần 5

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Các chương trình máy chủ không phải là đa luồng và không thể xử lý yêu cầu từ nhiều hơn một khách hàng. Ví dụ 2 chuyển đổi chương trình máy chủ với một phiên bản đa luồng để nó có thể xử lý yêu cầu từ nhiều hơn một khách hàng. | Java TM Language Basics Part 1 Lesson 8 Remote Method Invocation http developer.java.sun.com developer.raining Programming BasicJava1 rmi.html This lesson converts the File Input and Output application from Lesson 6 File Access and Permissions to the RMI API. Program Behavior The RMIClient1 program presents a simple user interface and prompts for text input. When you click the Click Me button the text is sent to the RMIClient2 program by way of the remote server object. When you click the Click Me button on the RMiciient2 program the text sent from RMiciientl appears. First Instance of Client 1 If you start a second instance of RMiciientl and type in some text that text is sent to RMiciient2 when you click the Click Me button. To see the text received by RMiciient2 click its Click Me button. Second Instance of Client 1 File Summary The example program consists of the RMIClient1 program remote object and interface and the RMIClient2 program as illustrated in the diagram. The corresponding source code files for these executables are described in the bullet list below. Server Object RMlQientl Program Send Remote Send Interface Object RMICIientZ RMIClientl Program sendData getDataf 1. sendData getDataf 1 1 1 Program RMIClient1.java Client program that calls the sendData method on the RemoteServer server object. RMIClient2.java Client program that calls the getData method on 2 of 11 21-04-2000 17 32 Java TM Language Basics Part 1 Lesson 8 Remote Method Invocation http developer.java.sun.com developer.raining Programming BasicJava1 rmi.html the RemoteServer server object. RemoteServer.java Remote server object that implements Send.java and the sendData and getData remote methods. Send.java Remote interface that declares the sendData and getData remote server methods. In addition the following java.policy security policy file grants the permissions needed to run the example. grant permission java.net.SocketPermission 1024-65535 connect accept resolve permission .