简体   繁体   中英

TCP flow control on Indy TCP Server

The Indy TIdTCPServer component has an OnExecute event where you can process incoming data. My application involves streaming data that is processed before going to a printer, so I'm dependent on the output device being ready. What I want to do is let the TCP flow control manage the input stream in the event of the output stream being busy.

What I don't know is how to best handle this situation. The Indy documentation is a little light on usage examples, any guidance appreciated!

You don't need to deal with TCP/IP flow control manually. Simply do not read any new input data in your OnExecute code if the the device is not ready, that is all you have to do. The data will sit in the socket's receive buffer until Indy reads it into its own buffer, where it will then sit unil you read it ino your own code. If the socket's receive buffer fills up, TCP/IP will automatically notify the other party to stop sending data until the buffer frees up some space.

not sure to what grade you already develped your own code. If your are still a beginner you might find the demo samples from http://sourceforge.net/projects/indy10clieservr/ helpful as a starting point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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