Term
When a call is “blocking”, what is happening on the machine? In the program? |
|
Definition
Function calls wait on results
Program can appear to ‘hang’ until timeout
Only handle one pending task.
Must wait for network operation to finish. |
|
|
Term
Under what conditions is a blocking socket considered “ready”? |
|
Definition
If the connection was closed, then a socket is considered ready for both reading and writing |
|
|
Term
What networking functions block and under what conditions? |
|
Definition
BLOCKS UNTIL
accept() - the application receives a connection request
connect() - connect completes (stream sockets)
recv()- network system recieves data for this socket
send()- buffers are available in the netweork system for outgoing data (stream sockets)
|
|
|
Term
Understand the concept of a descriptor (i.e. socket) set. |
|
Definition
|
|
Term
How can a socket be added to a set? Removed? |
|
Definition
FD_SET(s, *set) // Adds SOCKET s to set.
FD_CLR(s, *set) // Removes SOCKET s from set. |
|
|
Term
How does the select function work? What does it do? |
|
Definition
Determines which sockets are ready for accessing. Returns number of sockets. |
|
|
Term
How do we check to see if a socket is readable after calling select? |
|
Definition
FD_ISSET(listenSocket, &readSet) |
|
|
Term
Know about the different values for the timeval structure and how they affect select. |
|
Definition
struct timeval
{
int tv_sec; // seconds
int tv_usec; // microseconds
};
Defines a specific length of time is seconds & microseconds; is used by select() to determine blocking time.
timeval is set to NULL, fixed time, or 0 sec
|
|
|
Term
Understand how Networking Address Translation (NAT) works. |
|
Definition
IP translation and mapping
Allows a network to share a single internet connection over a single IP address
Acts as an interpreter between two networks
|
|
|
Term
What is the purpose of having a Master Server for a game or application? |
|
Definition
Global Server
Client Contacts to find games
Server contacts to update master |
|
|
Term
Know the difference in return values on a nonblocking socket between a disconnect error and a soft error (no data / space available.) |
|
Definition
Function calls return immediately |
|
|