Network Programming CS 228
Popular in Course
Popular in ComputerScienence
This 4 page Class Notes was uploaded by Kavon Reynolds on Thursday October 15, 2015. The Class Notes belongs to CS 228 at Northern Michigan University taught by Staff in Fall. Since its upload, it has received 33 views. For similar materials see /class/224059/cs-228-northern-michigan-university in ComputerScienence at Northern Michigan University.
Reviews for Network Programming
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/15/15
HTTP 1 Firefox has a setting browser cache check doc freguency entitled quotDocument is cache is compared to document on networ quot The choices are quotEvery timequot quotOnce per sessionquot and quotNeverquot For instance if quotevery timequot is set then the cached document is compared to the servers version every time the document is displayed to the user If the documents dilTer the new document is loaded What would be the most efficient way to implement this feature Use a Head command where possible Use a quotHeadquot command with a Sendifmodified ifpossible Use a quotGetquot command with a quotIfModifiedSincequot ifpossible Use a quotGetquot command with a quotSenddatequot or quotSendEtagquot modifier if possible None of these It39s actually 2 You want everything to go right What return code do you hope for from the server 1 Something in the 10039s 2 Something in the 20039s 3 Something in the 30039s 4 Something in the 40039s 5 Something in the 500 s 3 Using HTTP11 how can you tell what type the incoming file is 4 Suppose you make an HTTP 10 request You receive data in reply How can you tell where the metadata stops and the file contents begin Programming 1 As a receiver I execute the code ret readsock buf 1000 However the sender only sends 28 bytes and then closes the socket and then exist What value will I get for 39ret 2 Spock has 3 piles of Mars sand Kirk has 4 piles of Mars sand If they put them together how many piles do they have 3 Consider the two programs below What happens if I launch ONE server and the try and start TWO clients at nearly the same time main struct sockaddriin sa main intsa kn struct sockaddriin sa char hbstname1024 intsalen 5a5in7p0rt ht0n57777 sasinport htons7777 gethostnamehostname 1024 struct hostent h struct hostent hp gethostbynamequoteuclidnmueduquot gethostbynamelocalhostname bcopychar hp gthaddr char bCOpYChar hp gthaddrl Char ampsasin7addr hp gthilength ampSasiniaddr hpgthilength int sock sockethp gth7addrtype int sock sockethp gth7addrtype SOCK STREAM 0 SOCKisTREAM 0 int fd connectsock struct binds struct sockaddr ampsa sockaddr sa sizeofsa sizeofsa readfd buf 1024 liStenSI 99 cout ltlt buf ltlt endl int fd accepts struct sockaddr ampsa unsigned int sa71en sleep3600 wait for one hour writefd quotHiOquot 3 4What type of protocol does this program use Pick ALL that apply TCP UDP IP Aloha 5 Assume I run one client and one server from above and no errors occur Which of the following is true Pick exactly ONE a When the client nishes the connect call the server has nished accept b When the server nishes the socket call the client must have nished it s socket call c When the client is at connect the server is at bind d Both the server and client will run gethostbyname at the same time 6 With what type of problems does one use fork to handle multiple clients What is a good indication that the fork technique will work well TCPUDPIP 1 Suppose I start a TCP connection Ireceive bytes 0 1000 then 1001 2000 then 5000 6000 What byte number should my last ack contain 2 Suppose I am a TCP sender and a timeout occurs without receiving an ack What should do List two things 3 Suppose I am a TCP receiver and I receive a packet containing repeat data What should I do 4 How many packets does it take to send a small HTTP request and get a small reply Count all packets 5 SourceNot Source General Hospital is going to be attached to the Internet Do computers attached to the intemet generally choose the whole route when the packet is sent source routing or just choose the link to send the packet out on trusting that the next computer in line can send it closer still to the destination 6 Lost TCP ack s do not necessarily force a retransmission Explain how this can happen 7 Which is true about these protocols Put TCP or UDP next to each attribute Lower latency Larger header Retry after failure Used by HTTP 8 Suppose Iwant to send 50 bytes of data The transmission is successful Ignoring any ack s or ARPs how many bytes does each layer send IP Ethernet OT HER l YesNo Ethernet retransmits if there is a collision When I run TCP over Ethernet does the TCP software still set timers to detect lost packets 2 Suppose NMU had 6000 laptop computers and only 7 class C addresses What protocol could be used to assign IP numbers to laptops 3 Given the data above what percent of laptops could be in use at any one time SHOW WORK 4 Using BGP how much information does Northem s routers tell the rest of the intemet Just our connections off campus Those plus the topography of our internal networks That plus data about every computer attached to our networks 5 Calculus What does this expression evaluate to lim Xgt2 17 6 Using DHCP what must a client do if the server refuses to renew a lease and the lease period runs out 7 My IP number is 192 1681103 What is the host portion ofmy IP number The host portion is the part that says 39which computer within the given network NETWORK ADDRESS TRANSLATION 1 At my house we are using Network Address Translation to access the intemet via our cable modem When my computer goes to access wwwebaycom what IP number does it use for the destination on the outgoing packets The cable modem wwwebaycom something else my computer 2 At my house we are using Network Address Translation to access the intemet via our cable modem When my computer goes to access wwwebaycom what Ethernet MAC address does it use for the destination on the outgoing packets The cable modem wwwebaycom something else my computer 3 When wwwebaycom replies what IP address does it use on the reply The cable modem wwwebaycom something else my computer
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'