chapter 33: Networking Flashcards

basic understanding of internet terminology server sockets, client sockets, stream sockets, make a client/server application, InetAddress, develop applets that communicate with the server, send and receive objects on a network, make a tic tac toe game played on the internet

1
Q

Internet Protocol (IP)

A

A numeric address that uniquely identifies a computer on the internet. ex: 130.254.204.33

The IP is a low-level protocol for delivering data from one computer to another across the internet in packets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What makes an IP address?

A

four dotted decimal numbers between 0 and 255

ex: 130.254.204.33

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a domain name?

A

An identification string … Domain names serve as humanly memorable names for Internet participants, like computers, networks, and services.

www.google.com

“.com” is the top-level domain name. “google.com” is the domain name registered to google, and “google” is considered a second-level domain name. the “www” is the name of the web server (web host server) at the google.com domain.

www.google.com is a “fully qualified domain name (FQDN)”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a domain name server? (DNS)

A

a domain name server on the internet translates host names into IP addresses.

when a computer contacts google.com, it first asks the DNS to translate this domain name into a numeric IP address and then sends the request using the IP address.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What two higher-level protocols are using in conjunction with the Internet Protocol (IP) used to deliver data from one computer to another?

A
  • Transmission Control Protocol (TCP)

- User Datagram Protocol (UDP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does TCP stand for and what does it do?

A

-Transmission Control Protocol (TCP)

enables two hosts to establish a connection and exchange streams of data

guarantees delivery of data and also guarantees that packets will be delivered in the same order in which they were sent.

stream-based communcations use TCP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does UDP stand for and what does it do?

A

-User Datagram Protocol (UDP)

UDP is a standard, low-overhead, connectionless, host-to-host protocol that is used over the IP.

UDP allows an application program on one computer to send a datagram to an application program on another computer.

packet-based communications use UDP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What kinds of communication does java support, stream or packet?

A

java supports stream-based and packet-based.

however, TCP can detect lost transmissions and resubmit them. UDP cannot guarantee lossless transmission, so stream-based communication (TCP) is usually used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What java class enables us to create a server socket?

A

ServerSocket

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What java class enables us to create a client socket?

A

Socket

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do two programs on the Internet communicate with one another?

A

Two programs on the internet communicate through a server socket and a client socket using I/O streams.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a socket?

A

A socket is an endpoint of logical connections between two hosts and can be used to send and receive data.

java treats socket communications much as it treats I/O operations; thus, programs can read from or write to sockets as easily as they can read from or write to files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do the client and server communicate?

A

the client and the server communicate through sockets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do we establish a server?

A

We must create a server socket and attach it to a port.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a port?

A

A port is where the server listens for connections.

It identifies the TCP server on the socket.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What do port numbers range from?

A

0 - 65,536

17
Q

What port numbers are reserved for privileged services?

A

0 - 1024

18
Q

After the server accepts the connection, how is communication between server and client conducted?

A

It is the same as for I/O streams.

19
Q

Is it better to use text I/O or binary I/O? Why?

A

It is better to use binary I/O because text I/O requires encoding and encoding. Binary I/O improves performance.

20
Q

what java package should you import when writing java network programs?

A

java.net

21
Q

When a client connects to the server, a socket is created on the client. The socket has its own local port. How do we select the port number?

A

The JVM automatically chooses an available port to create a socket for the client.

22
Q

What class can we use to find out who is connecting to the server?

A

InetAddress

23
Q

How does java handle more than one client?

A

The connection to each client is handled by one thread.

A while loop creates a thread for each connection. pg. 1185

This makes it a multi-thread server.

24
Q

What classes do we use to send and receive objects?

A

ObjectOutputStream

ObjectInputStream

25
Q

What must we do to an object in order to enable passing?

A

The object must be serializable

implements java.io.Serializable

26
Q

What method enables a server Socket to listen for client connections?

A

accept()

27
Q

How does the client request a connection to a server?

A

the client requests a connection to a server by using

new Socket(serverName, port) to create a client socket.

28
Q

What classes can we use to get information about a web resource?

A

URL

URLConnection

29
Q

Break down this web address into its parts:

http://games.yahoo.com:80/games/login2?page=ch

A

protocol: http

host address: games.yahoo.com

server port number: 80

path to the resource file: games/login2?page=ch