John van de Waeter 7 Posted July 3, 2022 Hi All, I have an Indy tcp client and Indy tcp server, all working great. Yet I would like to reduce the connection time The "protocol" is as follows: Clients Connects Client sends size of idBytes (write Int32) Clients sends encrypted data (idBytes) containing command or question. Server receives and prepares answer Server encrypts answer Server sends size of answer (IdBytes, write int32) Server sends data (idBytes) Every sending of a packet induces radio-transmissions which have a long latency compared to a wired connection. When I download a picture I use on serverside: ... AContext.Connection.IOHandler.Write(astream,astream.Size,false); ... and on clientside: ... TCPClient.IOHandler.ReadStream(astream, -1, True) ... This sending and receiving of a stream has the possibility of specifying the size of the stream in the first bytes. My question: is it possible to send a TIdBytes with the size included? So the receiving end knows how many bytes to read, just like when using a stream? It would save one extra radio latency. Thanks in advance, John Share this post Link to post
Fr0sT.Brutal 900 Posted July 4, 2022 The most obvious answer is to prepare the packets manually and send them via single call. There are also plenty of buffered stream implementations which will take the burden of low-level memory management. But probably components have additional features like built-in buffering. Share this post Link to post