diff --git a/listen_and_play.py b/listen_and_play.py
index 35eabd6d59db650b99309ec3f1f49da3efe17fa1..701fe04050afe2dd085b39db12d1b97aa29506ed 100644
--- a/listen_and_play.py
+++ b/listen_and_play.py
@@ -113,6 +113,8 @@ def listen_and_play(
 
     finally:
         stop_event.set()
+        # Given that socket::recv is blocking in receive_data_chunk, shut it down to allow the thread to continue.
+        recv_socket.shutdown(socket.SHUT_RDWR)
         recv_thread.join()
         send_thread.join()
         send_socket.close()