1. | List and describe each step of the socket-based client-server connection scenario. |
|
2. | What class from the java.net package is used to listen for incoming socket connections? |
|
3. | Describe in general terms what is required to create a multi-threaded server application. |
|
4. | List and describe the steps involved with creating an RMI-based server application. |
|
5. | What must an RMI-based client do before it can use the services of a remote object? |
|
6. | What must be established prior to conducting effective socket-based client-server communications? |
|
7. | What interface does a remote object’s interface extend? |
|
8. | What class from the java.rmi.server package does a remote object extend? What interface does it implement? |
|
9. | What method found in the ServerSocket class blocks until an incoming client connection is detected? |
|
10. | What is the default RMI registry port number? |
|
11. | If a UTF string is written to an output stream using the DataOutputStream.writeUTF() method, what method of what class must be called to read the string on the receiving end? |
|
12. | What methods of the java.net.Socket class are used to retrieve the InputStream and OutputStream objects from the socket? |
|
Answers
1. | - a Socket object is used to connect to a ServerSocket object which is listening on a specified host and port. When the ServerSocket object detects an incoming client connection the accept() method will return a Socket object that can be used to communicate between server and client applications. |
2. | - ServerSocket |
3. | - A separate class that extends Thread or implements Runnable must be created to handle inter-application communication via the Socket object between the client and server applications. |
4. |
|
5. | - Get a reference to the service with the Naming.lookup() method. |
6. | - Appropriate inter-application protocols |
7. | - java.rmi.Remote |
8. | - UnicastRemoteObject; It implements the user-defined interface created by extending the java.rmi.Remote interface. |
9. | - ServerSocket.accept() |
10. | - 1099 |
11. | - DataInputStream.readUTF() |
12. | - getInputStream(), getOutputStream() |