gpt4 book ai didi

Delphi - 可以 indy TIdTCPClient 同时发送/接收大流

转载 作者:行者123 更新时间:2023-12-03 18:30:56 26 4
gpt4 key购买 nike

是否可以使用 同时发送/接收大型流? TIdTCPServer/TIdTCPClient 与同一个客户。

我在客户端创建了一个线程来处理传入的请求。

客户端收到请求,但在前一个请求完成(发送或接收)之前不会将其发送回服务器。

最佳答案

Is it possible to Send/Receive large streams at the same time with TIdTCPServer/TIdTCPClient with the same client.



是的,有可能。但是你怎么做取决于你的协议(protocol)实现。 TCP 套接字是双向和全双工的。您可以让一个线程发送而另一个线程正在接收。或者你可以将你的流分解成 block ,这样一个线程就可以发送一个 block 、读取一个 block 、发送一个 block 、读取一个 block 等。

I have create a thread on the client side to handle the incoming requests.

Client receive the request but it will not send it back to the server until the previous requite finished (sent or received).



这意味着您在单个线程中进行处理,并以串行方式一次处理一个请求,在这种情况下,您不会从连接中读取下一个请求,直到首先发送前一个响应。虽然这是典型的模型,但它可能不是正确的模型,具体取决于您的特定需求。

关于Delphi - 可以 indy TIdTCPClient 同时发送/接收大流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32875127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com