Informasjon

Forfatter(e) Maxime Piraux
Frist Ingen frist
Innleveringsgrense Ingen begrensning
Kategorimerkelapper socket

Merkelapper

Logg inn

Sockets - An advanced server application

In this exercise, you will implement a server for the protocol detailed in the previous task. Combine the code that you wrote previously and add the missing part for the application to be complete.

For each of the calls that you use, if one of them were to encounter an error, immediately return -1. All require headers are already included.

Manpages of interest:


An advanced server application

Copy the function signature and fill in its body

int recv_and_handle_message(const struct sockaddr *src_addr, socklen_t addrlen) {
    // TODO: Create a IPv6 socket supporting datagrams
    // TODO: Bind it to the source
    // TODO: Receive a message through the socket
    // TODO: Perform the computation
    // TODO: Send back the result
    return 0;
}