Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

CS 241

Compilation of knowledge starting from Networking

QuestionAnswer
Internet Protocol Primary way to send packets of information from one machine to another
IP4 or IPv4 is version 4 of the Internet Protocol that describes how to send packets of information across a network from one machine to another
Limitation of IPv4 Source and destination addresses are limited to 32 bits
IPv6 Latest protocol that solves many of IPv4's problems. A mchine can have both an IPv6 and an IPv4 address
What is 127.0.0.1 A speical IPv4 address known as local host. Packets sent here will never leave the machine.
Port To send a datagram(packet) to a host on the internet you need to specify the address and the port. The port is an unsigned 16 bit number.
What are the limits on listening to which ports? A process can listen for incoming packets on a particular port. However, only processes with super-user (root) access can listen on ports < 1024. Any process can listen on ports 1024 or higher.
What is port 80? Port 80 is used for unencrypted requests (web pages)
What is UDP? UDP is a connectionless protocol that is built on top of IPv4 and IPv6. Decide the destination address and port and send your data packet. However the network makes no guarantee about whether the packets will arrive.
When is UDP used? UDP is useful when receiving up to date data is more important than receiving all of the data such as for streaming or video game updates.
What is TCP? TCP is a connection-based protocol that is built on top of IPv4 and IPv6. It creates a pipe between two machines and abstracts away the low level packet-nature of the internet.
When is TCP used? Under most conditions, bytes sent from one machine will eventually arrive at the other end without duplication or data loss. Most services on the Internet use TCP because it hides the complexity of lower, packet-level nature of the internet.
How do I use getaddrinfo to convert the hostname into an IP address? Use getaddrinfo to build a linked-list of possible connections. Then use getnameinfo to convert the binary address into a readable form.
What does getaddrinfo return? getaddrinfo returns a linked list of addrinfo structs.
What is getaddrinfo? The function getaddrinfo can convert a human readable domain name into an IPv4 and IPv6 address.
How are domain names converted to an IP address? A system called "DNS" (Domain Name Service) is used. If a machine does not hold the answer locally then it sends a UDP packet to a local DNS server which in turn may query other upstream DNS servers.
IS DNS Secure? DNS by itself is fast but not secure. DNS requests are not encrypted and susceptible to "man-in-the-middle" attacks.
How to connec tto a TCP server? A TCP server is a web server. There are three basic system calls to connect to a remote machine. 1. getaddrinfo(determine address) 2. socket(create a socket) 3. connect(connect using socket and address information)
What is the role of the socket-call? The socket call creates an outgoing socket and returns a descriptor (sometimes called a 'file descriptor') that can be used with read and write.
Does the socket-call connect to anything? No the socket call will only create the file descriptor for read and write purposes. It is not connecting yet.
What is the role of the connect call? The connect call attempts the connection to the remote machine. We pass the original socket descriptor, the socket address information which is stored inside the addrinfo structure, and the size of the structure for different address structures.
How do I free the memory allocated for addrinfo structs? freeaddrinfo called on the top-most addrinfo will clean up the code
How do you handle errors with getaddrinfo? The return value of getaddrinfo is the error code. Use gai_strerror to get the equivalent short English error text.
How can you define the kind of connection? To define a desired connection, use the addrinfo structure that is passed into getaddrinfo to define the kind of connection you'd like. Modify it before calling getaddrinfo.
What is gethostbyname? gethostbyname is deprecated. It is the old way to convert a host name into an IP address.
What are the four ports of a server request using the Hypertext Transfer Protocol? 1. Method (GET, POST) 2.Resource (Desired File) 3. Protocol ("HTTP/1.0" 4.two new lines (/r/n/r/n)
What is htons? htons(xyz) returns the 16 bit unsigned integer 'short' value xyz in network byte order
What is hton1? hton1(xyz) returns the 32 bit unsigned integer 'long' value xyz in network byte order
When is htons used? These functions are read as 'host to network.' Host-ordering is little-endian or big-endian depends on the architecture of the machine.
What are the 'big 4' network calls to create a server? socket, bind, listen, and accept. These have a specific purpose and must be called in this order.
What is the purpose of calling socket? To create an endpoint for networking communication. A new socket by itself is not particularly useful because it is not bound to a particular network interface or port. Socket returns a network descriptor that can be used with later calls.
What is the purpose of calling bind? The bind call associates an abstract socket with an actual network interface and port. It's usually unnecessary to specify the outgoing port.
What is the purpose of calling listen? The listen call specifies the queue size for the number of incoming, unhandled connections i.e. that have not yet been assigned a network descriptor by accept. Typical values for a high performance server are 128 or more.
Why are server sockets passive? Server sockets do not actively try to connect to another host. They wait for incoming connections. They are not closed when the peer disconnects. When a remote client connects, it is immediately bumped to an unused port number for future communications.
What is the purpose of calling accept? The server calls accept to wait for new connections. This call will block if there are no new connections unlike the other calls. This call will block and only return when a new client returns.
What does the accept call return? The accept call returns a new file descriptor. This file descriptor is specific to a particular client. It is a common mistake to use the original server socket descriptor.
What are the gotchas of creating a TCP - server? Not specifying the SOCK_STREAM requirement for getaddrinfo. Not being able to re-use an existing port. Not initializing the unused struct entries. The bind call will fail if the port is currently in use.
Why can't my server re-use the port? By default, a port is not immediately released when the socket is closed. Instead the port enters a "TIMED-WAIT" state. this can lead to networking code appearing to fail.
Can a TCP client bind to a particular port? Outgoing TCP connections are automatically bound to an unused port on the client. Usually, it's unnecessary to explicitly set the port on the client because the system will intelligently find an unusued port on a reasonable interface.
What are the objectives of scheduling? Fairness, priority, efficiency, encourage good behavior, support heavy loads, adjusting to different environments
What are the quantitative objectives of scheduling? Fairness, efficiency, throughput(number of processes completed per unit time), waiting time, turnaround time(time from start to completion), response time
What are batch systems? Non-preemptive. Running process keeps CPU until it voluntarily gives it up. First come first serve or shortest job first.
What are interactive systems? Pre-emptive. Running process is forced to give up CPU in a round robin format. Priority.
What is priority scheduling? Higher priority jobs are more critical. Each job is assigned a priority and the highest priority job is run.
Created by: sleephe
Popular Engineering sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards