Write a code fragment that connects to a server running on gorge.divms.uiowa.edu at port 2345 and reads one line of text sent by the server.
A) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345) ;
Scanner scan = new Scanner(sock.getOutputStream() ) ;
String line = scan.nextLine() ;
B) Socket sock = new Socket(gorge.divms.uiowa.edu, 2345) ;
Scanner scan = new Scanner(sock.getInputStream() ) ;
String line = scan.nextLine() ;
C) Scanner scan = new Scanner(sock.getInputStream() ) ;
Socket sock = new Socket(gorge.divms.uiowa.edu, 2345) ;
String line = scan.nextLine() ;
D) Socket sock = new Socket(2345, gorge.divms.uiowa.edu) ;
Scanner scan = new Scanner(sock.getInputStream() ) ;
String line = scan.next() ;
Correct Answer:
Verified
Q24: What does the acronym SMTP stand for?
A)Simple
Q30: Which code fragment creates a server running
Q31: Show the command line that establishes a
Q32: a(n. _ is a pointer to an
Q32: Suppose that sock refers to a TCP
Q33: The _ is used to download received
Q34: A _ is an object that encapsulates
Q39: Write a code fragment that connects to
Q56: For test protocols, turn the socket streams
Q57: _ objects are used for communication (IO)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents