First thanks for this project, really helped me a lot! And I also want to ask if there are multiple phones streaming simultaneously, how should I modify the code to differentiate the phones and assign specific packets to the correct phone?
Currently, the code I used for phone streaming is the following:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
try_ctr = 0
#import pdb; pdb.set_trace()
with conn:
print('Running... Connected by', addr)
dict_list = []
ictr = 0
while True:
data = conn.recv(BufferSize)
# print(len(data), ' ', data)
if not data:
print('\n\nConnection broken by client\n')
break
else:
try_ctr += 1
print('\r', 'Successful read and decode, ', ictr, end='')
ictr += 1
try:
d2 = binary_decode(data)
except:
'''usual problem is multiple json packets and/or partial packets are read -- try switching app
to send binary data with defined size and then set BufferSize to the binary data size'''
print('\n\nUnable to decode, \ndata:\n{}\n'.format(data))
continue
dict_list.append(d2)
First thanks for this project, really helped me a lot! And I also want to ask if there are multiple phones streaming simultaneously, how should I modify the code to differentiate the phones and assign specific packets to the correct phone?
Currently, the code I used for phone streaming is the following:
Thank You!