The function “createSocket” allows the creation of a socket UDP or TCP and returns the socket created. It takes 2 arguments : - “addr” : a tuple of the server’s IP address and the port - “protocol” : type of the socket (“SOCK_DGRAM” or “SOCK_STREAM”)
The function “downloadUDP” allows to count the size of data received during every interval and calculate the bandwidth for each interval. It adds every measure of the bandwidth in a list called “listFinalDown”.
The function “parameters” recovers parameters entered by the user (“interval”, “duration”, “bandwidth”, “upload” and “download”) for the server. This function tests also if the input bandwidth exceeds the maximum buffer of the function “sendto()” and initializes the chronometer for the measures.