Java Reference
In-Depth Information
L ISTING 6.6 Continued
6
return b;
}
/**
* sends a command to the server
*/
private void sendCommand(char c){
try {
out.writeChar;
System.out.println(“BankClientManager- send command “+c);
} catch (IOException exce) {
System.out.println(“BankClientManager- sendCommand()”+exce);
}
}
}l
In Listing 6.7, an example of a new client application is shown. It uses the commands from the
BankClientManager class, and shows how classes and resources are provided transparently by
the underlying ApplicationHelper execution.
L ISTING 6.7 The BankClient Class
package com.marinilli.b2.c6.bank;
import java.io.*;
import java.net.Socket;
/**
* Chapter 6 - The Client
*
* @author Mauro Marinilli
* @version 1.0
*/
public class BankClient {
Socket socket = null;
private BankClientManager manager;
public BankClient(BankClientManager mngr) {
manager = mngr;
try {
executeTransaction();
// dismiss connection
manager.quit();
Search WWH ::




Custom Search