Homework Questions

IP Addresses

  1. Which of the following IP Addresses are possible? Explain (yes/no) for each answer choice.
    • 1.1.1.1.1: No, 5 dif numbers, not 4
    • 23.23.23.23: Yes, each number is in the range 0-255 and all seperated by periods
    • 134.492.100.0: No, 492 is over 255
    • 255.256.55.255: No, 256 is over 255
    • 2.93.255.19: Yes, each number is in the range 0-255 and all seperated by periods
  2. If Dian Du is at home on his home network and sends a message to every computer on the network, what is this an example of? Explain.
    • Multicast
    • Unicast
    • Broadcast - because ot send to all devices, LAN wide,

Models

  1. Three of the four following protocols are on the same layer. Identify which ones and what layer they are on, and why they are on each layer:
    • ASCII (see above for information)
    • FTP (facilitates the transfer of files over the internet) (TRANSFER LAYER)
    • TLS (see HTTPS section) (TRANSFER LAYER)
    • USB (permits data exchange between electronics) (TRANSFER LAYER)
  2. Telnet is an internet protocol that allows remote access to other computers over a local network or the internet. What layer of the OSI model would this protocol be located on? What is the function of this layer? Application, since its “User Interaction, like resource sharing”

DNS

  1. Bob wants to use the domain bob.is.the.best.com. What domain should he buy from a DNS provider (assume it is available)? What would be the subdomains? main domain will be: best.com subdomains will be: is.the.best.com, the.best.com, bob.is.the.best.com

HTTP and HTTPS

  1. What is a difference between HTTP and HTTPS?
    • What protocol does HTTPS use that HTTP doesn’t? HTTPS adds a layer of security by incorporating SSL/TLS (Secure Sockets Layer/Transport Layer Security) encryption that ensures the data exchanged between the user and the website is encrypted, making it hard to intercept or tamper with.
  2. Last trimester, we sent HTTP requests for our passion projects
    • Did we use HTTP or HTTPS? HTTPS
    • What are the benefits and disadvantages of this? Benefits: More secure than HTTP Disadvantages: Site can run slower

TCP and UDP

  1. Bob is setting up a video streaming service, and he needs the stream to be real-time.
    • What protocol should he use, TCP or UDP? Why? UDP, because its faster and actually can provide a real time stream since its faster, even tho it might not be perfect.
    • What are some cons of this protocol? Give an example of a potential issue. UDP most likely wont provide in great quality or latency, but it will be able to provide quickly. If theres enough money involed, TCP could still be a pretty good option, but it wont livestream as fast.
  2. TCP has error checking, which ensures that all packets arrive properly. Why is this important?
    • Give an example of how TCP ensures that there are no errors. TCP uses the ACKs system to confirm that the user recieves the message coming from the sender.
  3. Server A computer is communicating with Server B. They have already initiated communication, and Server A is now attempting to send data to Server B.
    • How does Server B ensure that they have received any sent packets before Server A continues sending packets in TCP? In UDP? TCP will use the ACKs system to check that the message sent has been recieved by the reciever. In UDP there is no check that the message has been properly sent.
    • What is another use of this? It lets one know that their message was recieved by the user, which helps when theres faulty internet, or a streaming service or Youtube channel knowing that their content has been uploaded.
def is_valid_ip(ip):
    # Split the IP address into octets
    octets = ip.split('.')

    # Check if there are exactly 4 octets
    if len(octets) != 4:
        return False

    # Check if each octet is a number between 0 and 255
    for octet in octets:
        if not octet.isdigit() or not 0 <= int(octet) <= 255:
            return False

    return True

def main():
    ip_address = input("Enter an IP address: ")

    if is_valid_ip(ip_address):
        print("Valid IP address.")
    else:
        print("Invalid IP address. Please enter a valid IP.")

if __name__ == "__main__":
    main()



Valid IP address.