Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run programs using TCP/IP from within IDE and expect them to work?

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.

like image 575
csharpdefector Avatar asked Oct 27 '10 22:10

csharpdefector


3 Answers

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.

like image 180
Gregor Brandt Avatar answered Oct 21 '22 17:10

Gregor Brandt


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?

like image 25
A.Bouchez Avatar answered Oct 21 '22 15:10

A.Bouchez


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!

like image 34
csharpdefector Avatar answered Oct 21 '22 15:10

csharpdefector