Write a Java program with the following descriptions:CS476/576
Assignment #6
Due Midnight, Friday Dec 7, 2001
NAME
Jtcpline - A Java program with a Swing interface that creates a chain of processes connected with tcp sockets.SYNOPSIS
java JtcplineDESCRIPTION
The
program creates a chain of N processes
with each process connected to its neighbour with a tcp connection. The
Swing interface for this program is shown in the following Figure
.
Upon the creation of the the last process in the tcpline, the last process will send a message through the tcpline indicating to the user to start providing input.Any line typed by the user in the TextLine will travel across the tcp line to the last process and then travels back to be displayed in the TextArea. Each process introduces a 1 second delay in the forward direction (from 1st to the last process).
When the user clicks on the Quit button, the processes are terminated in the reverse order of their creation, i.e., the last Nth process dies first and the first process dies last.
The program has two arguments:
Rhost
The default value for Rhost is "localhost" which means the tcpline processes are created at the localhost. However, a user my use the combo box to select another host (e.g., pitfall) where tcpline processes are created. In such case the Swing interface will run on localhost while the tcpline processes runs on pitfall ( see next figure )Nproc
The default value is 1, but a user my use the combo box to select another value in the range from 1-8.![]()
When the user clicks on the Go button, the program creates the N tcpline processes locally or remotely (based on the selected value of the Rhost).Swing GUI interface Notes:
The interface shown in the figure is just an example of what is required,
you may design your own interface but is should have the following components.In addition, the following constraints should be observed:
- Args area: containing two Combo boxes for selecting the program arguments.
- Two Bush Buttons: to start and to end the program.
- Input Line: to enter one line of text. The user types the Enter Key to send the typed text for a round trip through the tcpline.
- Output Area: A scrollable area for displaying the program messages. the user should be able to see the recent messages without explicitly scrolling. Scrolling should be used only to view old messages. For example, in my solution the lines are scrolled up, i.e., the most recent line is displayed at the top of the Text Area.
To get a feeling and gain more details about the specification
- You should have dialogue boxes to confirm or cancel the actions of both the Go and Quit buttons.
- The args combo boxes and the Go button should become insensitive after the start of the program.
- The input text line and the Quit button should become insensitive during the execution of the three program transactions (start, line-send and end).
- The interface should stay on the screen for a few seconds before quitting to give a chance to the user to read the sign off message.
of this program, execute my own solution under:
/home/cs476/public_html/fall01/assignments/a6/wahab
OR ClickHereExample:
The following figure is a snapshot of using the program, where
the values of Rhost is "localhost" and the value of Nproc is 2.
The user Quits the program after entering one line (cs476).