meta data for this page
This is an old revision of the document!
Task for week 42
The first task is about UDP (RFC).
- UDP is stateless, so
- How a server can keep track of the clients?
- Use the udpexample as base and add functionality to support multiple clients on the server
- How to verify that the receiver got the packet?
- Are there different approaches?
- How the order of received packets could be checked?
- What could be the ways of reacting to out of order packets (or packet loss)?
- Filling the buffer
- What approaches there are for filling a buffer with data that contains binary numbers, null byte separators and char strings?
- What are the ways of sending the previously mentioned data with UDP? What does the receiver have to account for?
- What is the packet size limit for UDP? What other limits there can be?
- Byte ordering (32bit vs 16bit vs 8bit)
- Pack numbers 715517, 53850 and 42 into one packet, send (
sendto()) and receive (
recvfrom()) it using UDP (use the udpexample), do it by using
- Appropriate integers (waste no space!) in correct format
- As char string with null byte (
\0) as separator between them. Remember to terminate (why?).
- Which one is the most optimal?
- 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()
getnameinfo() use see the man pages or look at the TCP example server.c
Task for week 44: TCP #1