Multiple Choice
Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and sends the message "Hello server" to the server and then reads the one-line response from the server.
A) Socket sock = new Socket(2345, gorge.divms.uiowa.edu) ;
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello server") ;
Pw) flush() ;
String line = scan.nextLine() ;
Scanner scan = new Scanner(sock.getInputStream() ) ;
B) Socket sock = new Socket(gorge.divms.uiowa.edu) ;
PrintWriter pw = new PrintWriter(sock.getOutputStream() , 2345) ;
Pw) println("Hello server") ;
Pw) flush() ;
Scanner scan = new Scanner(sock.getInputStream() ) ;
String line = scan.nextLine() ;
C) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345) ;
PrintWriter pw = new PrintWriter(sock.getOutputStream() ) ;
Pw) println("Hello server") ;
Pw) flush() ;
Scanner scan = new Scanner(sock.getInputStream() ) ;
String line = scan.nextLine() ;
D) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345) ;
PrintWriter pw = new PrintWriter(sock.getInputStream() ) ;
Pw) println("Hello server") ;
Pw) flush() ;
Scanner scan = new Scanner(sock.getOutputStream() ) ;
String line = scan.nextLine() ;
Correct Answer:

Verified
Correct Answer:
Verified
Q15: A thread dies _<br>A)when the client quits
Q28: To kill a server that was started
Q31: The _ is a complex collection of
Q48: The HTTP response code 404 means _.<br>A)the
Q55: The HTTP command PUT _.<br>A)returns the requested
Q64: A print writer buffers the characters that
Q66: For test protocols, turn the socket streams
Q66: To close a connection, which of the
Q69: The _ is used to download received
Q74: The numbers 130.65.86.66 denote a(n) _.<br>A) TCP