PYTHON:如何从使用zmqpoller的服务器连续接收数据?

2024-04-26 22:19:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是简单的请求.post()连接到服务器并接收数据的模块

ack = requests.post('<ip>/get_data, data=data, timeout=10.0, verify=False)

下面是服务器中使用zmq poller接收数据直到获得最终响应的get_data()方法。在

^{pr2}$

在服务器端,获得的响应记录如下:

2017-08-28_07:17:55.43370 WARNING: Iteration: 1, Length of Rows: 100
2017-08-28_07:17:55.44269 WARNING: Iteration: 2, Length of Rows: 100
2017-08-28_07:17:55.44894 WARNING: Iteration: 3, Length of Rows: 100
2017-08-28_07:17:55.45742 WARNING: Iteration: 4, Length of Rows: 100
2017-08-28_07:17:55.46327 WARNING: Iteration: 5, Length of Rows: 100
2017-08-28_07:17:55.46687 WARNING: Iteration: 6, Length of Rows: 100
2017-08-28_07:17:55.47074 WARNING: Iteration: 7, Length of Rows: 100
2017-08-28_07:17:55.47658 WARNING: Iteration: 8, Length of Rows: 100
2017-08-28_07:17:55.48385 WARNING: Last Iteration: 9, Length of Rows: 75

所以,我假设我在服务器端实现的zmq轮询器工作得非常好。但是,我很想知道如何将这9次迭代的数据发送回请求的客户机?在

P.S. I want to receive the data continuously in client side. You may suggest appending each batch of response somewhere and sending the final response back to the client. This won't be feasible when the response is too big (The requesting client would get timeout)


Tags: ofthe服务器clientdatagetresponsetimeout