Skip to content

Commit 50508ee

Browse files
committed
working on lists
1 parent 25bee11 commit 50508ee

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

Server_A/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def listen_server(serversocket):
5252
lock.acquire(True)
5353
global_file_list.append(data[:-3])
5454
lock.release()
55-
list_str = "/n".join(local_file_list)
55+
list_str = " ".join(local_file_list)
5656
msg = str(addr[1]) + " " + list_str + " " + "###"
5757
lock.acquire(True)
5858
server_sock_accept.sendall(msg.encode())
@@ -187,7 +187,7 @@ def main():
187187
print('Connect successful')
188188
lock.release()
189189
print('sending list')
190-
list_str = "/n".join(local_file_list)
190+
list_str = " ".join(local_file_list)
191191
msg = str(sock[1]) + " " + list_str + " " + "###"
192192
lock.acquire(True)
193193
server_conn.sendall(msg.encode())
@@ -217,6 +217,8 @@ def main():
217217
command = input()
218218
if(command == 'close' or command == 'exit'):
219219
sys.exit()
220+
if(command == 'list'):
221+
print(global_file_list)
220222

221223

222224
main()

Server_B/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def listen_server(serversocket):
5252
lock.acquire(True)
5353
global_file_list.append(data[:-3])
5454
lock.release()
55-
list_str = "/n".join(local_file_list)
55+
list_str = " ".join(local_file_list)
5656
msg = str(addr[1]) + " " + list_str + " " + "###"
5757
lock.acquire(True)
5858
server_sock_accept.sendall(msg.encode())
@@ -187,7 +187,7 @@ def main():
187187
print('Connect successful')
188188
lock.release()
189189
print('sending list')
190-
list_str = "/n".join(local_file_list)
190+
list_str = " ".join(local_file_list)
191191
msg = str(sock[1]) + " " + list_str + " " + "###"
192192
lock.acquire(True)
193193
server_conn.sendall(msg.encode())
@@ -217,6 +217,8 @@ def main():
217217
command = input()
218218
if(command == 'close' or command == 'exit'):
219219
sys.exit()
220+
if(command == 'list'):
221+
print(global_file_list)
220222

221223

222224
main()

Server_C/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def listen_server(serversocket):
5252
lock.acquire(True)
5353
global_file_list.append(data[:-3])
5454
lock.release()
55-
list_str = "/n".join(local_file_list)
55+
list_str = " ".join(local_file_list)
5656
msg = str(addr[1]) + " " + list_str + " " + "###"
5757
lock.acquire(True)
5858
server_sock_accept.sendall(msg.encode())
@@ -187,7 +187,7 @@ def main():
187187
print('Connect successful')
188188
lock.release()
189189
print('sending list')
190-
list_str = "/n".join(local_file_list)
190+
list_str = " ".join(local_file_list)
191191
msg = str(sock[1]) + " " + list_str + " " + "###"
192192
lock.acquire(True)
193193
server_conn.sendall(msg.encode())
@@ -217,6 +217,8 @@ def main():
217217
command = input()
218218
if(command == 'close' or command == 'exit'):
219219
sys.exit()
220+
if(command == 'list'):
221+
print(global_file_list)
220222

221223

222224
main()

server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def listen_server(serversocket):
5252
lock.acquire(True)
5353
global_file_list.append(data[:-3])
5454
lock.release()
55-
list_str = "/n".join(local_file_list)
55+
list_str = " ".join(local_file_list)
5656
msg = str(addr[1]) + " " + list_str + " " + "###"
5757
lock.acquire(True)
5858
server_sock_accept.sendall(msg.encode())
@@ -187,7 +187,7 @@ def main():
187187
print('Connect successful')
188188
lock.release()
189189
print('sending list')
190-
list_str = "/n".join(local_file_list)
190+
list_str = " ".join(local_file_list)
191191
msg = str(sock[1]) + " " + list_str + " " + "###"
192192
lock.acquire(True)
193193
server_conn.sendall(msg.encode())
@@ -217,6 +217,11 @@ def main():
217217
command = input()
218218
if(command == 'close' or command == 'exit'):
219219
sys.exit()
220+
if(command == 'listg'):
221+
print(global_file_list)
222+
if(command == 'listl'):
223+
list_local('Root')
224+
print(local_file_list)
220225

221226

222227
main()

0 commit comments

Comments
 (0)