Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Indy10 TCP Client Readln hangs
#2
(07-20-2018, 07:15 AM)Attix22 Wrote: Problem is I sometimes (like every 5 - 10 Minutes) experience a hang on the IOHandler.ReadLn call which can last till I send data over the same TCPClient Instance.

Sending and receiving are completely independent operations. ReadLn() will freeze until it receives what it is expecting (or until it times out). Sending data to the server will not fix that, unless that data triggers the server to send what ReadLn() is expecting.

(07-20-2018, 07:15 AM)Attix22 Wrote: Now I'm asking myself if there is a fundamental flaw in using a TCPClient like this?

In of itself, no. But what does the rest of your TIdTCPClient code look like? For instance, are you ever calling Connected() on the client? That performs a read operation, so it could corrupt communications by receiving bytes that ReadLn() is waiting for, putting them in the InputBuffer in the wrong order. Just a thought.

Reply


Messages In This Thread
Indy10 TCP Client Readln hangs - by Attix22 - 07-20-2018, 07:15 AM
RE: Indy10 TCP Client Readln hangs - by rlebeau - 07-20-2018, 04:35 PM
RE: Indy10 TCP Client Readln hangs - by Attix22 - 07-23-2018, 07:00 AM
RE: Indy10 TCP Client Readln hangs - by kudzu - 07-23-2018, 03:10 PM
RE: Indy10 TCP Client Readln hangs - by Attix22 - 07-24-2018, 06:48 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)