9 Sockets for Servers

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

The _______________ method expresses the relative preferences given to connection time, latency, and bandwidth for sockets accepted on this server.

setPerformancePreferences()

A design that prevents one slow client from blocking all the other clients is a ____________ design.

thread per connection *use a fixed thread pool to prevent DoS situations

There are four public ServerSocket constructors:

*You can pass 0 for the port number so the system will select an available port for you.

There are two primary things you want to store in your logs:

- Requests - Server errors

In Java, the basic life cycle of a server program is this:

1. A new ServerSocket is created on a particular port using a ServerSocket() constructor. 2. The ServerSocket listens for incoming connection attempts on that port using its accept() method. accept() blocks until a client attempts to make a connection, at which point accept() returns a Socket object connecting the client and the server. 3. Depending on the type of server, either the Socket's getInputStream() method, getOutputStream() method, or both are called to get input and output streams that communicate with the client. 4. The server and the client interact according to an agreed-upon protocol until it is time to close the connection. 5. The server, the client, or both close the connection. 6. The server returns to step 2 and waits for the next connection.

A daytime server listens on port

13

The echo protocol, defined in RFC _____, is one of the simplest interactive TCP services. The client opens a socket to port 7 on the echo server and sends data. The server sends the data back.

862 *client responsible for closing connection

What is the maximum queue length for incoming connection requests? A 50 B 128 C 75 D 125

A 50

What is an anonymous port?

A port chosen by the system at runtime

Which is used to determine is the input stream is open? A public boolean isInputShutdown() B public boolean isInputOpen() C public boolean isShutdown() D public boolean isShutdown()

A public boolean isInputShutdown()

Which of the following logs contains one entry for each connection made to the server? A Access B Error C Audit D Transaction

C Audit

Which of the following classes hold the content to send, the header to send, and the port to bind? A ServerSocket B Socket C RequestProcessor D SingleFileHTTPServer

D SingleFileHTTPServer

After a ServerSocket is created, what method is used to listen for incoming connections? A listen() B getInputStream() C getOutputStream() D accept()

D accept()

What establishes a telnet connection on port 25? A telnet host 25 B telnet 25 localhost C 25 telnet localhost D telnet localhost 25

D telnet localhost 25

There are seven levels defined as named constants in java.util.logging. Levels in descending order of seriousness:

Level.SEVERE (highest value) Level.WARNING Level.INFO Level.CONFIG Level.FINE Level.FINER Level.FINEST (lowest value)

Four general traffic classes are defined for TCP:

Low cost High reliability Maximum throughput Minimum delay

The ______________ option sets the default receive buffer size for client sockets accepted by the server socket.

SO_RCVBUF

The ______________ option for server sockets determines whether a new socket will be allowed to bind to a previously used port while there might still be data traversing the network addressed to the old socket.

SO_REUSEADDR

Socket options specify how the native sockets on which the ServerSocket class relies send and receive data. For server sockets, Java supports three options:

SO_TIMEOUT SO_REUSEADDR SO_RCVBUF

____________ is the amount of time, in milliseconds, that accept() waits for an incoming connection before throwing a java.io.InterruptedIOException.

SO_TIMEOUT If SO_TIMEOUT is 0, accept() will never time out. The default is to never time out. The getSoTimeout() method returns this server socket's current SO_TIMEOUT value

A server that always sends out the same file, no matter what the request is called:

SingleFileHTTPServer

The ______ log usually contains one entry for each connection made to the server.

audit

The _______ log contains mostly unexpected exceptions that occurred while the server was running.

error

The ServerSocket class provides two getter methods that tell you the local address and port occupied by the server socket. These are:

getInetAddress() getLocalPort()

The ____________________ system property points to a file in the normal properties format that controls the logging.

java.util.logging.config.file


Ensembles d'études connexes

ACCT 2 Chapter 5: Cost-Volume-Profit Relationships SW

View Set

TORT LAW - Chapter 3 summary - NEGLIGENCE

View Set

Chapter 28 Head And Spine Injuries

View Set

PREP U ::: Exam 1: Mood & Affect / Mental Health Concepts

View Set

genetics practice questions exam 2

View Set

CISSP-1-Security-And-Risk-Management

View Set

BLAW final exam practice problems

View Set