Cannot receive data using socket over several seconds when using camera

Hello!
I want to collect real-time data on UR pose and RealSense image. When collecting seperately, it works well. However, if collecting at the same time, the program will stuck after about 100 loops. So how should I receive them? The core code is as below:
``
camera = Camera()
camera.connect()
ur10 = UR10()
ur10.connect() # using socket

try:
while True:
frame_set = camera.pipe.wait_for_frames()
ee_pose = ur10.get_current_j()

except KeyboardInterrupt:
camera.disconnect()
ur10.disconnect()
``
Thank you very much.