Docsity

21 Problems on Network Programming - Assignment 2 | CS 228, Assignments of Computer Science

Toggle sidebar
bg1
Swine Flu Is Not A Computer Virus
0) (Yes I have/No, don't pass me) Have you obeyed the email instructions about moving programs to
folders?
1) How many bytes in a MAC address? _______________
2) Do wireless ethernet's have MAC addresses? _____________
3) To whom should the following ethernet packet be sent? (Hint: It might help if you break it into host
and network portions.)
198.110.193.255
4) I want to send a file between an infected and an uninfected pig1 2. The pigs are 1 years old. The one
way latency is 2 ms. The bandwidth is 3 megabits per second. Each computer has 4 gigabytes of
RAM. The file is 5 megabytes. The CPU's are 6 megahertz. It's 7 pm.
5) Which layers will sometimes retransmit? (Circle all that apply, or none)
Ethernet
IP
TCP
6) I want to send a packet to a computer in Swinelandia. Which would be better
Know it's IP address
Know it's MAC address
7) Suppose the sender sends me an array of chars. I want to null terminate that array. Write the line of
code needed to do so.
int len = read(fd, buf, max_buf_size);
____________________________________________________
8) Suppose I want to connect to a server, but the server is not running. Which function call (i.e. not
MakeSocket, but gethostbyname or socket or accept or connect or bind, or read or write etc) will fail?
1 Pigs actually carry swine flu. But cooked pork is safe. Raw pork is not.
2 Yes, it's a footnote on a test.
pf3

Partial preview of the text

Download 21 Problems on Network Programming - Assignment 2 | CS 228 and more Assignments Computer Science in PDF only on Docsity!

Swine Flu Is Not A Computer Virus

  1. (Yes I have/No, don't pass me) Have you obeyed the email instructions about moving programs to folders?
  2. How many bytes in a MAC address? _______________
  3. Do wireless ethernet's have MAC addresses? _____________
  4. To whom should the following ethernet packet be sent? (Hint: It might help if you break it into host and network portions.) 198.110.193.
  5. I want to send a file between an infected and an uninfected pig^1 2. The pigs are 1 years old. The one way latency is 2 ms. The bandwidth is 3 megabits per second. Each computer has 4 gigabytes of RAM. The file is 5 megabytes. The CPU's are 6 megahertz. It's 7 pm.
  6. Which layers will sometimes retransmit? (Circle all that apply, or none) Ethernet IP TCP
  7. I want to send a packet to a computer in Swinelandia. Which would be better Know it's IP address Know it's MAC address
  8. Suppose the sender sends me an array of chars. I want to null terminate that array. Write the line of code needed to do so. int len = read(fd, buf, max_buf_size);

  1. Suppose I want to connect to a server, but the server is not running. Which function call (i.e. not MakeSocket, but gethostbyname or socket or accept or connect or bind, or read or write etc) will fail? 1 Pigs actually carry swine flu. But cooked pork is safe. Raw pork is not. 2 Yes, it's a footnote on a test.
  1. Why did your professor buy ticket for his whole family to go to Mexico City in five weeks? Hates large crowds ... heard Mexico would be less crowded than normal Loves the excitement of combat immunology He's a neophile^3 and loves new experiences (never had pig flu) Wanted to see the biggest city in North America
  2. I want to send an HTTP request to a www.drugsforpig.com and get back a small reply. How many packets will get sent?
  3. Suppose my www.drugsforpigs.com request was successful. What's the first byte of data they send me? I don't want a long explanation, just a single byte.
  4. I'm sending email to my friend Wilbur (he's ill, but there's hope). I've just connected to his SMTP server. What's the first byte I send him. I don't want a long explanation, just a single byte.
  5. How did Wilbur become famous? (Yes, there is a famous Wilbur the pig.)
  6. I have a server that uses select and/or poll. I have 12 clients connected at this moment. How many server processes are there? a) 1 b )12 c) 13 d) 2
  7. Which of these looks like good server code? pid = fork() fd = accept ( ...) if (pid == 0) handle connect exit fd = accept( ..) pid = fork() if (pid == 0) handle connection exit while(1) pid = fork() fd = accept( ... ) if (fd == 0) handle connection exit while(1) fd = accept( .. ) pid = fork() if (pid > 0) handle connection exit
  8. Suppose computer #1 begins to transmit an ethernet packet that is 1400 bytes long. After 1, bytes of transmitting, an ethernet collision is detected. What should computer #1 do? 17)Suppose NMU had 6000 laptop computers and only 7 class C addresses. What protocol could be used to assign IP numbers to laptops? ________________________
  9. Given the data above, what percent of laptops could be in use at any one time? __________________% 3 The spell checker suggest I replace neophile with pedophile. That's the kind of thinking that computers do.