meta data for this page
  •  

This is an old revision of the document!


UDP

Task for week 42

The first task is about UDP (RFC).

  1. UDP is stateless, so
    1. How a server can keep track of the clients?
      • Use the udpexample as base and add functionality to support multiple clients on the server
    2. How to verify that the receiver got the packet?
      • Are there different approaches?
    3. How the order of received packets could be checked?
      • What could be the ways of reacting to out of order packets (or packet loss)?
  2. Filling the buffer
    1. What approaches there are for filling a buffer with data that contains binary numbers, null byte separators and char strings?
    2. What are the ways of sending the previously mentioned data with UDP? What does the receiver have to account for?
    3. What is the packet size limit for UDP? What other limits there can be?
  3. Byte ordering (32bit vs 16bit vs 8bit)
    1. Pack numbers 715517, 53850 and 42 into one packet, send (sendto()) and receive (recvfrom()) it using UDP (use the udpexample), do it by using
      1. Appropriate integers (waste no space!) in correct format
      2. As char string with null byte (\0) as separator between them. Remember to terminate (why?).
    2. Which one is the most optimal?
    3. Try to get the length of the created charstring with strlen() - why it fails?

Tools for the task

htons(), htonl(), ntohs(), ntohl(), socket(), sendto(), recvfrom(), bind(), getaddrinfo(), getnameinfo(), shutdown(), close()

memcpy(), memset(), strcpy(), strncpy(), strlen(), sizeof()

For getnameinfo() use see the man pages or look at the TCP example server.c


Task for week 44: TCP #1


CT30A5002 - Games and Networking