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
Internet Protocol (IP)
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.
What makes an IP address?
four dotted decimal numbers between 0 and 255
ex: 130.254.204.33
What is a domain name?
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)”
what is a domain name server? (DNS)
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.
What two higher-level protocols are using in conjunction with the Internet Protocol (IP) used to deliver data from one computer to another?
- Transmission Control Protocol (TCP)
- User Datagram Protocol (UDP)
What does TCP stand for and what does it do?
-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
What does UDP stand for and what does it do?
-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
What kinds of communication does java support, stream or packet?
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.
What java class enables us to create a server socket?
ServerSocket
What java class enables us to create a client socket?
Socket
How do two programs on the Internet communicate with one another?
Two programs on the internet communicate through a server socket and a client socket using I/O streams.
What is a socket?
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 do the client and server communicate?
the client and the server communicate through sockets
How do we establish a server?
We must create a server socket and attach it to a port.
What is a port?
A port is where the server listens for connections.
It identifies the TCP server on the socket.
What do port numbers range from?
0 - 65,536
What port numbers are reserved for privileged services?
0 - 1024
After the server accepts the connection, how is communication between server and client conducted?
It is the same as for I/O streams.
Is it better to use text I/O or binary I/O? Why?
It is better to use binary I/O because text I/O requires encoding and encoding. Binary I/O improves performance.
what java package should you import when writing java network programs?
java.net
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?
The JVM automatically chooses an available port to create a socket for the client.
What class can we use to find out who is connecting to the server?
InetAddress
How does java handle more than one client?
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.
What classes do we use to send and receive objects?
ObjectOutputStream
ObjectInputStream
What must we do to an object in order to enable passing?
The object must be serializable
implements java.io.Serializable
What method enables a server Socket to listen for client connections?
accept()
How does the client request a connection to a server?
the client requests a connection to a server by using
new Socket(serverName, port) to create a client socket.
What classes can we use to get information about a web resource?
URL
URLConnection
Break down this web address into its parts:
http://games.yahoo.com:80/games/login2?page=ch
protocol: http
host address: games.yahoo.com
server port number: 80
path to the resource file: games/login2?page=ch