Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disconnect from idTCPServer problem with idTCPClient

132 views
Skip to first unread message

jim_gilmartin

unread,
Oct 29, 2001, 9:28:29 PM10/29/01
to
I'm trying to disconnect the client from a command handler OnCommand event
in idTCPServer (indy 9.02). However, the client never seems to know (the
onDisconnect event never fires on the client) that the server has
disconnected from it, until the next time data is sent. Is there a way to
have the client know when a server has disconnected when it has happened?

Code is simillar to:

procedure TdmServer.tcpServerCommandHandlers0Command(ASender: TIdCommand);
begin
ASender.Thread.Connection.Disconnect;
end;

The server disconnects (and triggers the OnDisconnect event), but the client
doesn't seem to know.

Thanks
-- Jim


Arthuro

unread,
Oct 30, 2001, 3:57:10 AM10/30/01
to
<Jim Gilmartin> wrote in message news:3bde104c$1_1@dnews...

> I'm trying to disconnect the client from a command handler OnCommand event
> in idTCPServer (indy 9.02). However, the client never seems to know (the
> onDisconnect event never fires on the client) that the server has
> disconnected from it, until the next time data is sent. Is there a way to
> have the client know when a server has disconnected when it has happened?

This is a know issue. The way around is, is to let the server issue a last
command, and then close the connection from it's side. When the client
receives the last command. It shut's down it's own connection from it's
side.

If you don't notify the client that it has to shut down, it won't know that
the connection is closed.

Another approach is doing it the other way around. Let the client issue a
disconnect command to the server, and disconnect immedeately (sp?) after
that. Server terminates as normal..

hth,
Marco..

Kudzu - Team Indy

unread,
Nov 6, 2001, 12:42:54 AM11/6/01
to
"Arthuro" <hexor...@vaxor.com> wrote in news:3bde6b66_1@dnews:

> This is a know issue. The way around is, is to let the server issue a last

Its actually by design - of not only Indy but TCP.

> command, and then close the connection from it's side. When the client
> receives the last command. It shut's down it's own connection from it's
> side.

Which is why nearly every protocol "agrees" to disconnect, then BOTH sides disconnect so that no
sockets are left in intermediate states.

--
Chad Z. Hower (Kudzu) - http://www.pbe.com/Kudzu/
Current Location: St. Petersburg, Russia
"Programming is an art form that fights back"


0 new messages