Page 1 of 1

Suddenly Have To Use "ConnnectUsingTCP"

PostPosted: Tue Oct 24, 2017 12:11 pm
by fcwilt

For years I was able to start a new Delphi app (now using 10.2 on Windows 10) and use the global CodeSite instance to send messages to the CodeSite Viewer.

All has worked fine without any problems.

Now, for some reason, I have to put a call to "ConnectUsingTCP" on either the CodeSiteManager or on the global CodeSite instance itself.

It seems the call has to be in something early on, like in FormCreate or FormShow.

As a test I put the call on a Button on the Form but it had no effect.

A call to "ConnectUsingCopyData" has no effect, no matter when it is done.

I can change (using CheckBox controls) the active state of the destination options of Viewer, TCP or UDP and they do make a difference as I can see messages in the Dispatcher Log showing the registering/un-registering of loggers.

Any idea why I now have to include this call to "ConnectUsingTCP"?

Something has changed (or I changed it) but I cannot make any sense of what has happened.

Thanks much.


Re: Suddenly Have To Use "ConnnectUsingTCP"

PostPosted: Thu Oct 26, 2017 9:53 pm
by Raize Support
Hi Frederick,

Hmm. The ConnectUsingTcp method is only really necessary if you are trying to send CodeSite messages from your application to the CodeSite Dispatcher, but the Dispatcher is running in a different window station. Windows does not allow windows messages (i.e. wm_CopyData) from crossing window station boundaries. For example, this is necessary if you are trying to send CodeSite messages from a service application to the Dispatcher running on the user's desktop. Service apps run in a different window station.

The issue can also come up if you have registered the CodeSite Dispatcher to run as a service. Do you recall running the commands outlined in the CodeSite Help to install the Dispatcher as a service. You could check the Services app in Windows to see if the CodeSiteDispatcher shows up. If it does, you can use the following commands to uninstall the Dispatcher as a service.

Be sure to start the command prompt as an Administrator.

1. Stop the Dispatcher service

C:\> net stop CodeSiteDispatcher

2. Uninstall the service

C:\> CSDispatcher /uninstall

After the dispatcher is uninstalled as a service, you should be able to send CodeSite messages to the Live Viewer without calling ConnectUsingTcp first.


Re: Suddenly Have To Use "ConnnectUsingTCP"

PostPosted: Fri Oct 27, 2017 9:35 pm
by fcwilt

Thanks for the information.

I checked and the Dispatcher is not installed as a service.

Are there any settings anywhere in the Windows Registry or a INI file that would cause this problem?

Could a recent update of Windows 10 caused this problem?

Thank you for you assistance.

CodeSite is one of the finest programming tools I have ever had the pleasure to use.

I was greatly relieve when you "retrieved" it from Embarcadero.


Re: Suddenly Have To Use "ConnnectUsingTCP"

PostPosted: Sat Oct 28, 2017 3:53 pm
by Raize Support
Hi Fredrick,

There is no registry entry that would control this behavior. What version of Windows 10 are you running? You can check by clicking Start > Settings > System > About. I've been using Windows 10 for quite some time and have not experienced any problems.

Is your computer set up for multiple users? If so, could another user account still be active? This could happen if you "switched" to another user account instead of logging out. And if the Dispatcher was stared under the other user account that could possibly cause the issue you are running into.

To help narrow down the issue, please try the following and let me know what happens.

1. Make sure all CodeSite tools (CodeSite Dispatcher, CodeSite Live Viewer, CodeSite File Viewer, etc) are not running. Check the Task Manager to be sure the Dispatcher is not running in the background.

2. Start Delphi and create a new VCL Form Application. Drop a TButton on the form and then double click the button.

3. In the Button1Click event handler add a simple CodeSite statement such as:
CodeSite.Send( 'Test Message' );

4. Add the CodeSiteLogging unit to the uses clause.

5. Save the project files and run the application. The CodeSite Dispatcher should get started and then the CodeSite Live Viewer should get started and your Test Message should appear.


Re: Suddenly Have To Use "ConnnectUsingTCP"

PostPosted: Sat Oct 28, 2017 7:52 pm
by fcwilt

Well I fired up Delphi 10.2 and create a basic "Hello, World" app to test CodeSite.

It worked fine - just like I was used to.

Then I tried 10.2 - same thing - worked fine.

Then I thought perhaps it was something about the particular app I had been working.

So I opened that up, removed the call to "ConnectUsingTCP" - and IT WORKED.

While I am still curious as to what went wonky, CodeSite seems to be working fine - except perhaps on Tuesdays - I will check next week. ;)

Thanks much.