Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: IdTCPServer
| Subject: | Re: IdTCPServer |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Thu, 8 Jun 2006 13:43:38 |
"brandon" <someone@microsoft.com> wrote in message
news:448887fc$1@newsgroups.borland.com...
> The server is actually the Indy sample that came with Delphi 6. I did
> little or no modifiaction to the server sample that was shipped.
> The client was also based on the Indy sample. I have made modification
> to to it only to handle different message types (Private, Global,
Internal...)
I don't have the samples onhand. Please just show the offending code.
> The actual error appears to be that when a client session terminates in
> an "unclean" manner, the server becomes unstatble. By that I mean, it
> appears that the next user to attempt to connect gets the "Socket Error #
0"
> message.
That is very unlikely. Every client has its own unique socket endpoint in
the server. Even if one client did crash, or otherwise got disconnected
abnormally, the other clients would not be effected. Unless the network
itself is having problems, that is.
> Starting at the botom of the call stack and working up, the first line of
> code that belongs to me is line 213:
> if not IdTCPClient1.Connected then IdTCPClient1.Connect(10);
> As stated above, it appears that the server has become unstable when a
user
> terminates the session without allowing the application to issue a clean
> disconnect. Subsequent attempts by the offending user or other users
> attempting to attach to the server raise the connection error at the
client
> end.
That is not what the call stack was showing. But again, you did not show
the COMPLETE call stack.
> I am only speculating with regard to the server being "unstable", it
> is only an observation of a person with limited exposure to Indy.
Did you try connecting to the server with any non-Indy clients? The Telnet
client that is built into Windows is useful for debugging.
> There are no error messages at the server when the clients receive the
error.
Are any of the server events being triggered?
> There is a listbox at the server that shows which users are logged into
> the server
Updating the UI from inside TIdTCPServer event handlers is not thread-safe,
unless TThread.Synchronize() or TIdSync.Synchronize() are being used.
Gambit