Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : Re: Indy 9 - not detecting disconnect over VPN
| Subject: | Re: Indy 9 - not detecting disconnect over VPN |
| Posted by: | user@domain.invalid |
| Date: | Wed, 19 Sep 2007 14:28:14 |
Remy Lebeau (TeamB) wrote:
>
> Just show the relevant code here. If it is large, then post to the
> .attachments newsgroup instead.
>
The client issues
Count := Client.readinteger;
which blocks while it waits for data. The server disconnects but we are
still in this code. (verified with debug statements such as:
try
FrmSocketTest.ClientDebugLog('before read');
Count := Client.readinteger;
FrmSocketTest.ClientDebugLog('after read');
...
except
FrmSocketTest.ClientDebugLog('exception');
)
debug output shows the 'before read' only.
> Either the reader is not checking for a disconnect properly (which is not
> likely since you are using Indy, which does such checks internally),
or the
> OS is not reporting the disconnect to begin with.
>
If the OS is not reporting the disconnect, what can I do?
> Otherwise, get rid of Win32Check() and use PostThreadMessage()'s return
> value directly instead:
>
> if not PostThreadMessage(...) then
> Dispose(infoRec);
>
Thanks... I'll do that.