I just ventured into writing my first socket based programs in Delphi 2010. I tried with Indy, no success, just even writing a simple client and server that could send packets. Then I used TTCPServer and TTCPClient, same results using the following 'simple as it gets' demos :-
Emmbercadero TTCPServer demo
Emmbercadero TTCPClient demo
I had fired up 2 instances of the IDE for the client and server apps. I was pretty determined to avoid the shame of posting a question related to the socket based version of 'helloworld', and I just spent 2 days trying everything.
Well I just decided to chuck the towel in and ask you guys for help, before i did, I just run the exes from OUTSIDE the IDE... and yeah, they worked! They worked the whole time, but not from inside the IDE.
Can I run these programs inside the IDE sucessfully? Thanks.
There should be no problems running from inside the IDE. I do it all the time.
Make sure you don't freeze any threads in the debugger, as the server will run in threads.
TCP/IP programs (of both Client and Server type) can be run safely from the Delphi IDE.
The only concern could be about your FireWall settings, but it could be no problem to allow your program to have network access.
During debugging, if you make step-by-step (F7/F8 keys), only one thread is running, so any background thread (like the Server thread) won't run.
You must launch the Server before running the Client, by design.
I never used the TTCPClient and TTCPServer classes, which I found out to be buggy... try with another framework, like Indy, Synapse or our SynCrtSock.
Which Delphi IDE version are you running? On which Operating System?
Thanks for all your help. I just found the solution to my problem...
I had some time ago installed a trial of a program called Diamond Port Explorer which had since expired. When I was trying to get a simple Indy TIdTCPServer working I was getting error 10146 (or 10106 can't remember) which was 'failed to initialise'. I also nocticed the the Ide event log a module unload occurred at the point I tried to set TIdTCPServer.Active:= true on dcsws2.dll - which is a dll from Diamond PortExplorer (which was not actually running).
So I uninstalled Diamond PortExplorer, and now I have no problem!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With