Jump to content
The simFlight Network Forums

Using FSUIPC in .NET How to check if fsuipc is connected


Recommended Posts

Hi Peter,

i use fsuipc in VB.NET. I have a timer which reads the data via FSUIPC in fixed intervals. But how can i check if FSUIPC-Connectiont to the flightsimulator is already established? I do not want to catch the exeption after reading data without connection. Is there a simple way to check? Maybe something like this: FSUIPCConnection.connected = True ?

Best regards

Andi

Link to comment
Share on other sites

i use fsuipc in VB.NET. I have a timer which reads the data via FSUIPC in fixed intervals. But how can i check if FSUIPC-Connectiont to the flightsimulator is already established? I do not want to catch the exeption after reading data without connection. Is there a simple way to check? Maybe something like this: FSUIPCConnection.connected = True ?

Sorry, I've no idea about anything in VB, let alone VB.Net. However, the connection has to be Opened first. If it opens successfully then the connection is established, if it doesn't you have to wait a while then try again.

If you mean you want to detect if FS is closed or crashed, so becomes unresponsive, then read offset 337E at intervals and use a timeout for it to change. But remember to allow time then for delays in menus or loading scenery, flights, aircraft etc., when FSUIPC cannot update it.

Regards

Pete

Link to comment
Share on other sites

Hi Andi,

I'm Paul - I wrote the .NET client DLL.

There is no 'connected' property you can check. There isn't much to be gained by adding one in either.

The only way you can get an 'open connection' is by calling FSUIPCConnection.Open() and your code must make this call. Therefore, you can keep track of if you've opened the connection or not yourself. The same goes for the Close() method.

If you're looking for a way to tell if Flight Sim has been shut down after you've called Open() then the correct way to do this by catching the exception thrown from the read. This is how things are done correctly in .NET programming.

The only way my DLL could tell if the connection is still established is by doing a 'fake' read and catching the exception, so there's not much to be gained by building this into a 'connected' property.

I hope this explains why there isn't anything like a 'connected' property you can check. If you need any more info just ask...

Paul

Link to comment
Share on other sites

Thank you very much for your answer!

Of course i catch the exceptions :) but i needed the state to display the status in my application.

I now changed my programm so that the exception of the process sets the status.

By the way, do you read all fsuipc data via simconnect from fsx or do you also use another interface to fsx? You have some Data in FSUIPC which i can not find in simconnect.

Many thanks for your help and best regards

Andi

Link to comment
Share on other sites

By the way, do you read all fsuipc data via simconnect from fsx or do you also use another interface to fsx? You have some Data in FSUIPC which i can not find in simconnect.

I guess this one is for me! ;-)

The vast majority is from SimConnect. Other stuff is obtained by direct hooks into parts of FS, and a very few bits are via the gauges interface into PANELS.DLL. Before SimConnect it was nearly all by hooks into parts of FS. The idea of SimConnect was to provide all the required data, and write access, "officially", and the FS team intended to fulfill all the needs I listed and to extend this over time, with quarterly updates to SimConnectUnfortunately the bean counters took over and stopped all that, so we were then left to wait for FSXI for the fulfillment of many of the promises. Now of course it is all at an end.

Regards

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.