Jump to content
The simFlight Network Forums

Recommended Posts

Hi,

I need to remotely connect to P3D via SimConnect. I have 2 PCs.

Server: PC1 with P3D v4 installed, IPv4:192.168.10.139 

Client: PC2 has a C# WPF app that does some reading & writing to P3D on PC1 via SimConnect. IPv4:192.168.10.167

I have put SimConnect.cfg file on PC2, Documents folder, put SimConnect.xml, EXE.xml and DLL.xml files on PC1, C:\Program Files\Lockheed Martin\Prepar3D v4 folder, put SimConnect.ini file on PC1, C:\Users\Administrator\Documents\Prepar3D v4 Files folder. I save all these 5 files as Unicode type for encoding.

In SimConnect.cfg:
 

Quote

[SimConnect]
Protocol=IPv4
Address=192.168.10.139
Port=5800
MaxReceiveSize=4096
DisableNagle=0

 
In SimConnect.xml:
Quote

  <!-- Example Global (remote) IPv4 Server Configuration-->
  <SimConnect.Comm>
    <Disabled>False</Disabled>
    <Protocol>IPv4</Protocol>
    <Scope>global</Scope>
    <MaxClients>64</MaxClients>
    <Address>192.168.10.139</Address>
    <Port>5800</Port>
  </SimConnect.Comm>

 

 
In SimConnect.ini:
Quote

[SimConnect]
level=verbose
console=No
;RedirectStdOutToConsole=Yes
;OutputDebugString=Yes
;file=c:\simconnect%03u.log
;file_next_index=0
;file_max_index=9

 

As for EXE.xml and DLL.xml files, I didn't do any changes as I found no instructions about them.

In the WPF app code on PC2:

private const int WM_USER_SIMCONNECT = 0x0402; //user-defined
this.SimConnect = new SimConnect("Managed Data Request", Handle, WM_USER_SIMCONNECT, null, 0); // it can be executed with no error or exception as long as the SimConnect.cfg file is OK.        
private IntPtr HandleSimConnectEvents(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam, ref bool isHandled)        
{            
  isHandled = false;            
  switch (message)            
  {                
    case WM_USER_SIMCONNECT:// This is never met! But if P3D and the WPF app run on the same PC then it works.                    
      {                        
        if (SimConnect != null)                        
        {                            
          try                            
          {                               
            this.SimConnect.ReceiveMessage();                           
          }                            
          catch 
          { 
            RecoverFromError(); 
          }                            
          isHandled = true;                        
        }                    
      }                    
      break;                
      default:                    
      break;            
  }            
  return IntPtr.Zero;        
}
The remote connection between P3D and the WPF app is not successful. I appreciate any help.
Edited by JeffJiang

Share this post


Link to post
Share on other sites
2 hours ago, JeffJiang said:

I have put SimConnect.cfg file on PC2, Documents folder, put SimConnect.xml, EXE.xml and DLL.xml files on PC1, C:\Program Files\Lockheed Martin\Prepar3D v4 folder, put SimConnect.ini file on PC1, C:\Users\Administrator\Documents\Prepar3D v4 Files folder. I save all these 5 files as Unicode type for encoding.

This is actually the Support Forum for FSUIPC, WideFs and related programs, not for Prepar3D or its SimConnect which aren't my programs! Really you should post such questions on the L-M P3D forum.

Anyway, I also use simConnect remotely for some applications I use, but I've never saved any such files as Unicode, and I'm pretty sure that wouldn't be correct for the FSX versions of SimConnect you need to install on the remote PC.

Speaking of which, are you sure you installed the correct version of SimConnect on your client to suit the program(s) you want to use? Generally I install all three -- RTM, SP1 and SP2 to be sure.

Pete

 

 

Share this post


Link to post
Share on other sites

Hi Pete,

Thanks for your reply. Now I can connect them. The problem is just that I misunderstood the path to put the SimConnect.xml. Now the path is correct and they are connected!

Kind regards,

Jeff

Share this post


Link to post
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


×