简体   繁体   English

Delphi-Indy TIdTCPClient可以同时发送/接收大数据流

[英]Delphi - Can indy TIdTCPClient Send/Receive large streams at the same time

Is it possible to Send/Receive large streams at the same time with TIdTCPServer/TIdTCPClient with the same client. 是否可以通过具有相同客户端的TIdTCPServer / TIdTCPClient同时发送/接收大数据流。

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). 客户端接收到该请求,但是在上一个请求完成(发送或接收)之前,它不会将其发送回服务器。

Is it possible to Send/Receive large streams at the same time with TIdTCPServer/TIdTCPClient with the same client. 是否可以通过具有相同客户端的TIdTCPServer / TIdTCPClient同时发送/接收大数据流。

Yes, it is possible . 是的,有可能 But how you do it depends on your protocol implementation. 但是如何执行取决于您的协议实现。 TCP sockets are bi-directional and full-duplex. TCP套接字是双向的和全双工的。 You could have one thread sending while another thread is receiving. 您可能有一个线程正在发送,而另一个线程正在接收。 Or you can break up your streams into blocks so one thread can send a block, read a block, send a block, read a block, etc. 或者,您可以将流分成多个块,以便一个线程可以发送一个块,读取一个块,发送一个块,读取一个块等。

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). 客户端接收到该请求,但是在上一个请求完成(发送或接收)之前,它不会将其发送回服务器。

This implies that you are doing your processing in a single thread, and doing the entire processing one request at a time in a serial manner, where you are not reading the next request from the connection until the previous response has been sent first. 这意味着您要在单个线程中进行处理,并以串行方式一次完成一个请求的整个处理,在这种情况下,您不会从连接中读取下一个请求,直到先发送上一个响应。 While this is the typical model, it might not be the right model, depending on your particular needs. 虽然这是典型的模型,但根据您的特定需求,它可能不是正确的模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM