Write the required lines of code that will create a


Question 1. Write the listenSocket method (server-side program).

a - Write the required lines of code that will create a ServerSocket object with a port number 3421 on which the server program is going to listen for client communications.

b- Write the required lines of code that will create a new socket object.

c - Write the required lines of code that will read the data sent over the socket connection from the client program.

Question 2. Write the listenSocket method (client-side program) with the hostname mydevry2 and port number 2431. Write it to send the data over the socket connection to the server and read the text sent by the server back to the client. (Points : 30)

Question 3. Complete the following Java Applet program that will check whether the input value (integer) is even or odd.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CheckInput {

JLabelresultLbl;
JLabelinputLbl;
JTextFieldinputTxt;
JButton check;

public void init() {
JPanel panel = new JPanel(new GridLayout(4,2));
panel.add(new JLabel("Input:"));
inputTxt = new JTextField();
panel.add(inputTxt);
panel.add(new JLabel("Result:"));
resultLbl = new JLabel();
panel.add(resultLbl);
check = new JButton("Check");
panel.add(check);
check.addActionListener(this);
getContentPane().add(panel);
}
public void actionPerformed(ActionEvent arg0) {
}
}

Question 4.

a - Create a new cookie with the following information:

Name: userEmail
Value: [email protected]

b - Add the above cookie to the response header.

c - Retrieve the value of the above cookie from the list of all available cookies. (Points : 30)

Question 5. Write a program that will create two threads and will print out the following information:
o Thread 1:
M
N
o Thread 2:
P
R

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write the required lines of code that will create a
Reference No:- TGS01084876

Expected delivery within 24 Hours