@@ -160,23 +160,23 @@ def refresh_connections(): # used to remove any lost connections
160160def list_connections ():
161161 refresh_connections ()
162162
163- if len (arrConnections ) > 0 :
164- strClients = ""
165-
166- for intCounter , _ in enumerate (arrConnections ):
167-
168- strClients += str (intCounter ) + 4 * " " + str (arrAddresses [intCounter ][0 ]) + 4 * " " + \
169- str (arrAddresses [intCounter ][1 ]) + 4 * " " + str (arrAddresses [intCounter ][2 ]) + 4 * " " + \
170- str (arrAddresses [intCounter ][3 ]) + "\n "
171-
172- strInfo = f"\n ID{ 3 * ' ' } "
173- for index , text in enumerate (["IP" , "Port" , "PC Name" , "OS" ]):
174- strInfo += center (str (arrAddresses [0 ][index ]), text ) + 4 * " "
175- strInfo += f"\n { strClients } "
176- print (strInfo , end = '' )
177- else :
163+ if not len (arrConnections ) > 0 :
178164 print ("No connections." )
165+ return
179166
167+ strClients = ""
168+ for intCounter , arrAddress in enumerate (arrAddresses ):
169+ strClients += str (intCounter )
170+ for value in arrAddress :
171+ strClients += f"{ 4 * ' ' } { str (value )} "
172+ strClients += "\n "
173+
174+ strInfo = f"\n ID{ 3 * ' ' } "
175+ for index , text in enumerate (["IP" , "Port" , "PC Name" , "OS" ]):
176+ strInfo += center (str (arrAddresses [0 ][index ]), text ) + 4 * " "
177+ strInfo += f"\n { strClients } "
178+ print (strInfo , end = '' )
179+
180180
181181def select_connection (connection_id , blnGetResponse ):
182182 global conn , arrInfo
0 commit comments