Question: - This is to be created using NetBean - Java - Server: io.wind-100 - port#: 5520 1. The Server is running a proprietary protocol called

- This is to be created using NetBean

- Java

- Server: io.wind-100

- port#: 5520

1. The Server is running a proprietary protocol called Knock Knock Protocol. It will only respond when your Client is following the protocol correctly. When your Client is successfully connected to the Server, You must follow the protocol as follows.

First message sent to the Server must be Knock Knock; this is like saying hello to the Server. The message is not case-sensitive on the Server side. The Server will send whos there? back to the Client, but if you send anything else, the Server simply doesnt understand and will send ???.

Next, the Client must identify itself to the Server in response to the message whos there?. For example, Banana. After that, the Server will send Banana who? back to the Client.

When the Server send Banana who? the Client can send a Knock Knock joke to the Server. The Server is not very smart, but she is very kind, so whatever joke you sent, she will always LOL!

Because the Server is very accommodating, the Client can tell her another Knock Knock joke even if the previous one is not funny. In this case, the Client must send Knock Knock again!

The Client can send a quit message anytime to disconnect from the Server, who would send a Good Bye! message back to the Client. The quit message is not case-sensitive.

2. Your GUI (JFrame) should include the following Java Swing components.

A JLabel and a JTextField for entering the Server address; set text to IO.WIND-100.

A JLabel and a JTextField for entering the port number, set text to 5520.

Have a Connect/Disconnect JButton, and set text to Connect. When the Connect button is clicked, connect to the port and server specified. Also, change the text to Disconnect. When Disconnect is clicked, close the connection and change the text back to "Connect. If the connection dies for any reasons, the button must display Connect. And whenever the Client is connected to the Server, the button must display Disconnect. Make sure your Connect/Disconnect button is in the correct state.

A JLabel, JTextField and a Send button for sending a message (String) to the Server.

A JLabel and a read-only JTextArea (in the Design view in NetBeans, uncheck the editable box) for displaying messages. DO NOT print anything to System.out. Use the append() method of JTextArea to display all messages, including the communications between the Client and the Server, error messages and the connection status (either connected to ., or disconnected). DO NOT CLEAR the messages in the JTextArea.

3. Your program must not crash under any situation and must always be in a sane state. You must try-catch everything and print out appropriate error messages identifying the specific exception

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!