开发者

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

开发者 https://www.devze.com 2023-01-22 12:14 出处:网络
I just ventured into writing my first socket based programs in Delphi 2010. I tried with Indy, no success, just even writing a simple clie开发者_StackOverflownt and server that could send packets. The

I just ventured into writing my first socket based programs in Delphi 2010. I tried with Indy, no success, just even writing a simple clie开发者_StackOverflownt 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!


I had similar problems when deploying a datasnap server and client. The problem I had was that the DSServer was already running and the port was in use. So make sure you check all your ports and whether your connections are active in the IDE and also in the running apps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号