Question: Consider the following java program Consider the following Java program: 1: public class TCPServer 2: public static void main(String argv) throws Exception ( 3: 4

Consider the following java program  Consider the following java program Consider the following Java program: 1:

Consider the following Java program: 1: public class TCPServer 2: public static void main(String argv) throws Exception ( 3: 4 5: 6: 7: 8: 9: 10: String clientSentence String capitalizedSentence ServerSocket welcomeSocket-new ServerSocket(6789); while(true) Socket connectionSocket = BufferedReader inFromClient new BufferedReader( new InputStreamReader(connectionSocket.getinputStream) DataOutputStream outTClient = new DataOutputStream( connectionSocket.getOutputStreamO); clientsentence = inFromClient.readLine(); capitalizedSentence clientSentence.toUpperCase() + , n.; outToClient.writeBytes(capitalizedSentence); 12: 13: 14: 15: 16: 17:) Question 1: Complete line 7. Question 2: Extend the server to print the IP address/port of every connecting client Use line numbers to indicate which lines should be changed/removed and where new code should be added Question 3: Assume that 3 different machines connect to the server (sequentially). As a result, how many Socket objects will be created by the server? How many TCP ports will be assigned to the server (not including the already assigned port 6789)

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!