-
Notifications
You must be signed in to change notification settings - Fork 0
/
UDP_rdt_main_client.py
36 lines (30 loc) · 1.01 KB
/
UDP_rdt_main_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from UDP_rdt_client import UDP_rdt_client, close_UDP_rdt
import time
import pandas as pd
tamanhos = [500, 1000]
HEADER_SIZE = 42
for tamanho in tamanhos:
tempos = []
sizes = []
total_pacotes = []
for i in range(10):
tempo, contador_pacotes = UDP_rdt_client(tamanho, HEADER_SIZE)
time.sleep(1)
close_UDP_rdt()
tempos.append(tempo)
sizes.append(tamanho)
total_pacotes.append(contador_pacotes)
print(f"Finished iteration {i} for size {tamanho}")
time.sleep(2)
results = pd.DataFrame({
'Tamanho': sizes,
'Tempos': tempos,
'Pacotes': total_pacotes
})
if tamanho==100:
results.to_csv("ResultadosUDPComGarantiaPCPETEthernet.csv",index=False)
else:
file_df = pd.read_csv("ResultadosUDPComGarantiaPCPETEthernet.csv")
file_df = pd.concat([file_df,results], ignore_index=True)
file_df.to_csv("ResultadosUDPComGarantiaPCPETEthernet.csv",index=False)
time.sleep(5)