Java Reference
In-Depth Information
ASK IF USER WANTS TO DO ANOTHER READ/SEND.
******************************************************/
}while (!option.equals("n"));
}
private static void doSend()
{
System.out.println("\nEnter 1-line message: ");
String message = userEntry.nextLine();
networkOutput.println(name);
networkOutput.println("send");
networkOutput.println(message);
}
private static void doRead() throws IOException
{
/*********************************
BODY OF THIS METHOD REQUIRED
*********************************/
}
}
_______________________________________________________
//For use with exercise 2.4.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class Echo extends JFrame
implements ActionListener
{
private JTextField hostInput,lineToSend;
private JLabel hostPrompt,messagePrompt;
private JTextArea received;
private JButton closeConnection;
private JPanel hostPanel,entryPanel;
private fi nal int ECHO = 7;
private static Socket socket = null;
private Scanner input;
private PrintWriter output;
public static void main(String[] args)
Search WWH ::




Custom Search