Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Nov : TidTCPServer - OnConnect and OnDisconnect - Incorrectly fires???

www.cryer.info
Managed Newsgroup Archive

TidTCPServer - OnConnect and OnDisconnect - Incorrectly fires???

Subject:TidTCPServer - OnConnect and OnDisconnect - Incorrectly fires???
Posted by:"PeaShooter_OMO" (..@me.com)
Date:Mon, 27 Nov 2006 12:20:38

Good day

I add TidTCPServer and TidTCPClient components ( Indy 9.00.10 ) to a form in
Delphi 7. I Set the Server component bindings to 127.0.0.1:10111 and the
Client Host to 127.0.0.1 and its Port to
10111. I add a "Client.Connect" line to a ButtonClick without a timeout and
add some code to the OnConnect and OnDisconnect events of the Server. This
code will for instance set a Label on the form
to "Connected" or "Disconnected".

The problem is that when I connect by clicking the button then both
OnConnect and OnDisconnect events on the Server component is fired. First
the OnConnect and immediately after that the
OnDisconnect event is fired. Is this right and if so, why?

Does Indy need a proper network connection to function because when I did
this I didn't have a network connection. I also tried after adding a MS
Loopback Adapter connection but it also did the same.

Thank you

Replies:

www.cryer.info
Managed Newsgroup Archive