Modify Example5*.java so that the ConnectionRequestor sends a replying message to the ConnectionAcceptor after receiving a message from the Acceptor. The replying message should be displayed by the Acceptor. Hand in a event diagram, the program listings. and run outcome.

This exercise guides you through experiments with connection-oriented datagram socket using code sample Example4.


```

public class Example5ConnectionAcceptor {



// An application which receives a message using stream-mode socket

// Two command line arguments are expected, in order:

//

//



public static void main(String[] args) {

if (args.length != 2)

System.out.println

("This program requires three command line arguments");

else {

try {

int portNo = Integer.parseInt(args[0]);

String message = args[1];

// instantiates a socket for accepting connection

ServerSocket connectionSocket = new ServerSocket(portNo);

/**/ System.out.println("now ready accept a connection");

// wait to accept a connecion request, at which

// time a data socket is created

MyStreamSocket dataSocket =

New MyStreamSocket(connectionSocket.accept( ))

/**/ System.out.println("connection accep

Computer Science & Information Technology

You might also like to view...

Which of the following is not part of a computer’s hardware?

a. The keyboard. b. The operating system. c. The hard disk. d. The screen.

Computer Science & Information Technology

Overriding a method differs from overloading a method because:

a. Overloaded methods have the same signature. b. Overridden methods have the same signature. c. Both of the above. d. Neither of the above.

Computer Science & Information Technology

Create a personal budget. Put income in its own column, then total the values. Put expenses in another column, then total the values. The more accurate you are, the closer your budget will be.

What will be an ideal response?

Computer Science & Information Technology

The array char message[81]; can be used to store a string of up to ____ characters.

A. 79 B. 80 C. 81 D. 82

Computer Science & Information Technology