IndySockets / Indy

Indy - Internet Direct
https://www.indyproject.org
434 stars 147 forks source link

TIdHL7.SynchronousSend does not respect timouts #501

Open rlebeau opened 9 months ago

rlebeau commented 9 months ago

See post on Delphi Praxis: https://en.delphipraxis.net/topic/10228-tidhl7synchronoussend-does-not-respect-timouts/

I want to send some HL7 messages to SERVER. The server is online and it gets the messages send by SynchronousSend method and responds for them (confirmed). My logs show that the code works as expected but only for the very first call SynchronousSend (the method returns srOK and a valid reply sent byt the remote server). Unfortunatelly, every next call of SynchronousSend returns srTimouts, even if the result is returned just a few miliseconds after call, what is strange because ... the timeouts are set for 60 seconds

... today's tests show that the app sends the messages every second time (I mean, the first call returns srOK and a valid reply, the second, srTimout and no reply, the third, as the first, srOK and the fourth, as the second, srTimeout, and so on). Looking into code I noticed that when the AsynchronousSend returns srTimeout the method DropClientConnection is called... I suppose that could be the cause of such a behavior...

I also tried to use another approach. I changed the CommunicationMode to cmSingleThread, and then I was calling SendMessage and GetReply. Unfortunatelly, without success. GetReply returned srNone evere time. It is quite strange because, as one can read in comments, the state srNone is internally used and (should be) never returned