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 send data with a random size during the “duration” informed by the user. It sends data with a rate forced every second to the bandwidth given by the user.
The function “parameters” allows to recover parameters from the client (“interval”, “duration”, “bandwidth”, “upload” and “download”). Before recovering parameters, the function does a synchronization with the client sending a start message. This function tests also if the input bandwidth exceeds the maximum buffer of the function “sendto()”.