Socket Programming Assignment 2 Udp Pinger Lab Solution Software

CSC 360 Computer Networks

Weber/Fall, 2016


  • My office hours for final exam week are posted on my weekly schedule.
  • The final exam, scheduled for Wednesday, December 14, from 1 to 4 pm, will be comprehensive. Approximately 80% of the test will cover chapters 1-5, with the remaining 20% covering the material from chapter 6.  The final exam will about twice the length of an in-class test. Here are some sample questions from chapter 6. Here are the answers to the sample questions.  Here are quick links to topics from old material: test 1, test 2, test 3.
    Topics from Chapter 6
    • Services provided by link layer, where link layer is implemented.
    • Error detection via parity, checksums, and CRC checks
    • Multiple Access Links and Protocols: TDM vs FDM, Random Access (ALOHA and slotted ALOHA, CSMA, CSMA/CD, CSMA/CA), Polling vs Token passing protocols
    • Switched Ethernet LANS: MAC addresses, ARP, Ethernet Frame structure, Ethernet technologies, Link-Layer switches & self-learning
    • A Day in the Life
  • From chapter 6, read sections 6.1-4, and 6.7-8.  You can skip subsections 6.3.4 and 6.4.4.
  • The deadline for the programming project has been pushed back to Friday, December 9.

Old announcements

  • Test 3 will be on Thursday, December 1, and will cover material from chapters 4 and 5.  Here is a sample test; take a good look at it in preparation for the review session on Tuesday, Nov. 29. Here is a link to the answer key for the sample test.
    • (Added 11/29) IP Lab
    • Network layer overview, including forwarding vs routing, and data plane vs control plane
    • Router architecture (routing processor, ports & switching network)
    • IP protocol
      • datagram format
      • fragmentation and reassembly
      • IPv4 addressing (including CIDR and subnet masks)
      • DHCP
      • NAT
      • ICMP (and how traceroute uses ICMP)
      • SNMP
      • IPv6 basics (datagram format and transition techniques)
    • Routing algorithms
      • Dijkstra/link state
      • Bellman-Ford/distance vector
      • Problems & solutions (oscillations, routing loops  poisoned reverse)
    • Routing in the Internet
      • Hierarchical routing using autonomous systems
      • OSPF (intra-AS)
      • BGP (inter-AS
    • Software Defined Networks
      • generalized forwarding
      • Remote controller/local control agents
      • SDN controller in between network control applications and network switches
      • OpenFlow protocol
  • Test 3 will be on Thursday, December 1, and will cover material from chapters 4 and 5.  Preparation materials will be posted over Thanksgiving break.
  • There will be a lab on Tuesday, November 15; read the directions posted below.  Go directly to 057 KHIC instead of T-H 100.
  • Remember that team members and project choice are due Thursday, November 10 in order to avoid a penalty.
  • The project description has been posted below.
  • There will be a reading quiz on sections 4.1 and 4.2 on Thursday, November 10.
  • Test 2, on chapter 3, will be on Tuesday, November 8. Take a look at the sample test.  Here are the answers to the sample test.
  • Important topics for test 2:
    • Transport layer addressing issues; multiplexing & demultiplexing
    • UDP, including the basic mechanism of the one's complement checksum
    • Reliable data transfer stop and wait models rdt1.0 through rdt 3.0
    • Reliable data transfer pipelined protocols Go-back-N and Selective-Repeat
    • TCP, including segment structure, reliable data transfer mechanisms, flow control and connection management.
    • TCP congestion control basics
    • TCP Lab
  • Lab 2 will be held on Thursday, October 27.  Go straight to the CS Lab (057 KHIC) at the beginning of class on Thursday.  Be sure to read the lab directions before you come.
  • There will be a reading quiz over section 3.6 on Tuesday, October 25.
  • There will be a reading quiz over section 3.5 on Thursday, October 20.
  • There is no class on Tuesday, October 18; the University will be following a Monday schedule that day.  Our next class meeting is Thursday, October 20.
  • Reading quiz on section 3.4 on Tuesday, October 4.
  • Here's the sample test and the sample test with answers for Test 1.  Try not to look at the answers until you've at least attempted the problem.
  • You should find this blog post by Bruce Schneier interesting, in light of what we've learned about DNS.
  • Test 1 Topics:
    • Chapter 1
      • hosts/end systems, communication links, packet switches & routers
      • Internet protocols, standards, RFCs, IETF
      • Access networks: DSL, cable, home and institutional networks, wireless
      • physical links: guided (coax, twisted pair, fiber optic) vs unguided (radio)
      • Packet switching: store and forward
      • Circuit switching: TDM and FDM
      • Comparison of packet switching and circuit switching
      • Internet structure: (tiered) network of networks, ISPs, IXPs, regional networks, content provider networks
      • Delay in packet-switched networks: transmission, propagation, queuing, and processing delay; traffic intensity; measuring real delays (traceroute)
      • Packet loss
      • Throughput
      • Internet protocol stack, ISO/OSI reference model, encapsulation
      • Network security: historical problem with Internet, viruses, worms, botnets, DDoS attacks, packet sniffing, IP spoofing
      • There will be no questions from section 1.7
    • Chapter 2
      • Network apps: client-server,P2P architectures
      • Processes, communicating by exchanging messages
      • Sockets
      • Addressing: IP address + port number
      • Transport services (UDP and TCP) and the transport service requirements of apps.
      • SSL/TLS
      • HTTP: stateless, connection oriented, on port 80, persistent or non-persistent
      • HTTP GET and other requests, request format
      • HTTP response, response format, including status codes
      • HTTP cookies
      • HTTP caching and conditional get
      • Electronic mail: user agents, POP, IMAP, HTTP; mail servers, SMTP (uses 7 bit ASCII)
      • DNS: distributed database + application-layer protocol
      • DNS hierarchy: local name server, authoritative name server, TLD servers, root servers; iterated vs recursive query; cached entries; DNS records and protocol message formats
      • Attacks on DNS: DDoS
      • P2P file distribution applications: comparison of P2P to client-server model
      • BitTorrent: torrent, churn, requesting chunks, sending chunks/tit-for-tat
      • Video streaming: spatial and temporal encoding, CBR, VBR, DASH
      • CDNs: comparison to "mega-server"; enter deep vs bring home strategies
      • Socket programming: be familiar with the steps required by a client/server pair to connect and exchange text messages via TCP and via UDP
  • Test 1, over chapters 1 and 2, is scheduled for Tuesday, September 27.  Take a look at the sample test; answers will be posted later.
  • Reading quiz on Tuesday, September 20, on sections 2.6 and 2.7.
  • Our first lab will be the Wireshark lab on DNS, on Thursday, September 15; be sure to read the directions before you come to class.  Also, come to 057 KHIC right at the beginning of class.  It would help if you find a lab partner before you get to class that day.
  • Reading quiz on Tuesday, September 13 on sections 2.4 and 2.5.
  • A written homework assignment has been posted below.
  • Start reading Chapter 2 of the textbook
  • Reading quiz on Thursday September 1 on sections 2.1 and 2.2
  • Read Chapter 1 of the textbook.
  • Reading quiz on Thursday August 25 over sections 1.1-1.2.


A2: due 10/20
Answer problem R13 in chapter 3 (p. 288 289) via email. Notice that there are actually four parts to this problem: a, b, and c form R12, but for Selective Repeat, as well as the question "How are GBN and SR different?"
A1: due 9/8
Chapter 1: problems P2, P4, P5, P6, P8, P10, P25, P29 on pp. 70-77.  For problem P8, you can use the function in Excel to compute the binomial distribution values needed.


L3 on 11/15, report due 11/22
Wireshark lab on IP; Notes:
  • There will be a small penalty (approximately 5% of the total lab score) if you aren't working with anyone else or if you are working with more than one other person.
  • Hand in answers to the questions, as well as printouts from Wireshark to support your answer, ALL ON PAPER.
  • For all traceroute probes, use as the destination.
  • If you are using a Windows machine, instead of PingPlotter, use WinMTR.  If you are on a lab computer, you can start it from here: M:\CSIS\WEBERK\Handout\CSC360\WinMTR\WinMTR-v092\WinMTR_x64\WinMTR.exe
  • Before you start capturing packets with Wireshark, determine the answer to question 0: What is the largest datagram size that "works" with traceroute/WinMTR when you use as the destination? Be sure to write the answer to question 0 into your lab report.
  • Use Wireshark to capture packets for a traceroute request to for a datagram of 56 bytes only. Don't bother with datagram sizes of 2,000 and 3,500.
  • Use your packet capture for questions 1 through 9.
  • Use the packet trace file ip-ethereal-trace-1 (see instructions) to answer questions 10 through 15.
L2 on 10/27, report due 11//1
Wireshark Lab on TCP.  Notes:
  • There will be a small penalty (approximately 5% of the total lab score) if you aren't working with anyone else or if you are working with more than one other person.
  • Hand in answers to the questions, as well as printouts from Wireshark to support your answer, ALL ON PAPER. Use the guidelines provided in the paragraph just before questions 1 and 2 to create printouts of packets. Be sure to include the name of all teammates.
  • Use the packet trace file tcp-ethereal-trace-1 (see instructions) to answer questions 1, 2, and 13.
  • Use your own packet capture to answer questions 3 through 12, and 14 (even though footnote 4 may seem to apply).  Section 1 of the directions provides the steps to take to capture appropriate packets.
  • For questions 4 and following, to see true sequence numbers, turn off relative sequence numbers by selecting Edit->Preferences->Protocols->TCP, then unchecking the box for relative sequence numbers.
  • For questions 7 and 8, use the first six segments that show up in the Round Trip Time Graph, which may be different than the first six segments starting at the segment that includes the POST.
L1 on 9/15, report due 9/20
Wireshark Lab on DNS.  Notes:
  • Hand in answers to the questions, as well as the requested printouts from Wireshark and the requested screenshots, ALL ON PAPER. Be sure to include the name of all teammates.
  • There will be a small penalty (<= 5% of score) if you aren't working with anyone else or if you are working with more than two others.
  • All the commands (, etc). must be issued from the same computer that you are running Wireshark on, for otherwise you won't see the desired activity in the packets inside of Wireshark.
  • You can capture a screen shot of the cmd window on Windows by pressing ALT+PrtScn.  You can then paste it into MS Paint, or some other program that can handle images, to print it.
  • If you are using a Mac:
    • should be issued within a Terminal window, which you can open from the Finder search box.
    • Use instead of
    • Do a Google search on flush DNS cache mac to learn how to flush the DNS cache.  The command will ask you for your password—if you own the computer, the password for your normal username should work for .
  • The notes on Mac generally apply to Linux as well, except for flushing the DNS cache--just Google flush DNS cache linux.  Or better yet, use the name of your distro instead of the word linux.
  • is no longer responding, so use
  • is no longer a DNS server, so instead find the primary DNS server for and use it.
  • Repeat the last experiment (the one with questions 20-23) using instead of the primary server for



For the programming project, you are to either do the UDPPinger programming project or the ICMPping programming project that are described in the Python 3110 Socket Programming Assignments (need to be logged in for this link to work) from the textbook's student resources pages.

Programming project details

  • The project will be due on Tuesday, December 6Friday, December 9.
  • You will need to work with exactly one partner.  There will be a 5% penalty if you choose to work alone.
  • You and your partner must send me an email, informing me of your partnership, and which project you choose to do, by Thursday, November 10.  If this deadline is not met, a 5% penalty will be assessed.
  • It is expected that you will do all parts of the project, including the two optional exercises.

Programming project resources

These links are meant to provide some hints as to the parts of Python you'll need to use, as well as starting places for exploring their features.

  • Python 3.5.2 documentation.  This is the version of Python in the lab, and the version I expect you to use.
    • Tutorial
    • socket library module.  See also the notes on timeout.
    • Handling exceptions
    • datetime library module
    • Timer object, which may come in useful for UDP Pinger Optional Step 2 (which is required for the project).
    • To execute a Python script in the lab, open a CMD window and run the following command, replacing with the name of whatever script you want to execute, and with your login name. C:\Users\weberk\AppData\Local\Programs\Python\Python35-32\python.exe


  • Exploring UDP  lab on p. 302 of the textbook. I recommend you go through this lab for your own understanding.  Grab the UDPClient and UDPServer code in M:\CSIS\WEBERK\Handout\CSC360\socketProgrammingExamples and modify UDPClient to allow the user to type in the IP address of the server so that you can run the client and Wireshark on one machine and the server on another.  Then examine the UDP traffic generated by this simple application.  Try to answer the questions from the lab. Hints; if you filter by udp.port == 12000 you will only see the traffic for this app; also, it will be less confusing if you disable the LLC protocol that Wireshark attempts to use to decode the data inside the UDP packet. One last thing:  question 6 refers to Fig. 4.13 of the textbook, but the figure that they want you to look at in this version of the text is 4.16 on p. 330.
  • Socket programming examples from section 2.7 can be found at M:\CSIS\WEBERK\Handout\CSC360\socketProgrammingExamples
  • Windows script to connect to weberkcudafac via PuTTY is in M:\CSIS\WEBERK\weberkcudafacConnections\weberkcudafacPuTTY.bat
  • Wolfram MathWorld entry on Binomial Distribution.
  • How to activate Telnet in Windows 7
  • Textbook website
  • Wireshark
  • Simulation applets from the 6th edition of the textbook.  Reequires a java-enabled browser, such as Firefox or Safari, and a security exception  for added to the Java runtime (On Windows, type j into the searchbar to add a security exception.)
  • Powerpoint slides can be found in M:\CSIS\WEBERK\Handout\CSC360.

- Вычитайте, да побыстрее. Джабба схватил калькулятор и начал нажимать кнопки. - А что это за звездочка? - спросила Сьюзан.  - После цифр стоит какая-то звездочка.


Leave a Reply

Your email address will not be published. Required fields are marked *