V
@archivator said:for socket in read: buff = ''.join((buff,socket.recv(48))) # data always comes in 48 B packets; #also, this is claimed to be faster than buff += socket.recv(48) count += 1 if count % 15 == 0: if len(send_buff) > 0: playback_queue.append(send_buff) send_buff = '%s' % buff # the send buffer is always 15 packets behind buff buff = r''it's interesting that you've noticed that str.join is supposed to be faster that +=.it is, but not the way you're using it. Both ways involve copying the entire buffereach time you add to it. This should be obvious to anyone with C experience, becausestrcat behaves the same way. The correct thing to do is to build a list of strings,and join them when you need a result. None of this matters, however, since you may as well simply wait for all the packets to arrive. Along the same lines, why are you polling a socket if you're waiting to read from itbefore you can do anything anyway? I assume you left out a heap of code, includingwhatever you do to capture_queue. The sad part is, it shouldn't take many more linesto make the proxy complete. I assume also that you realise that [, is a syntax error, and the forum software issimply on crack. Also, while 1: is ugly. use while True: (This is O(len(buff)) rather than O(len(buff) ** 2)) for s in read: buff = s.recv(720) # don't loop needlessly if len(send_buff) > 0: playback_queue.append(send_buff) send_buff = buff # the send buffer is always 15 packets behind buff buff = '' # no need for raw strings, you have nothing to escape. Apologies for code mode, my first post :)