[RESOLVED] SimConnect network configuration problem
-
- Posts: 58
- Joined: Fri Aug 18, 2017 1:04 am
[RESOLVED] SimConnect network configuration problem
I have 2 PCs.
PC1: With P3D installed. IPv4 address:192.168.10.139
PC2: A WPF application, need to remotely control P3D on PC1. IPv4 address:192.168.10.167
I think PC2 is the Sim server while PC1 is the Sim client. (Am I right?) According to the SDK instruction,
SimConnect.xml needs to be put on PC2 (sim server), under folder "C:\Program Files\Lockheed Martin\Prepar3D v4".
SimConnect.cfg needs to be put on PC1(sim client), under folder "C:\Users\Administrator\Documents".
I have modified these 2 files.
In SimConnect.xml:
<!-- Example Global (remote) IPv4 Server Configuration-->
<SimConnect.Comm>
<Disabled>False</Disabled>
<Protocol>IPv4</Protocol>
<Scope>global</Scope>
<MaxClients>64</MaxClients>
<Address>192.168.10.167</Address>
<Port>500</Port>
</SimConnect.Comm>
In SimConnect.cfg:
[SimConnect]
Protocol=IPv4
Address=192.168.10.167
Port=500
MaxReceiveSize=4096
DisableNagle=0
I also put SimConnect.ini under folder ".../Documents/Prepar3D v4 Files" for both PC1 and PC2 because the SDK Document says " the file should be placed in your %USERPROFILE%\Documents\Prepar3D v4 Files folder" but doesn't indicate the server or the client.
In SimConnect.ini:
[SimConnect]
level=verbose
console=Yes
;RedirectStdOutToConsole=Yes
;OutputDebugString=Yes
;file=c:\simconnect%03u.log
;file_next_index=0
;file_max_index=9
In the WPF application on PC2, I wrote
this.SimConnect = new SimConnect("Managed Data Request", Handle, WM_USER_SIMCONNECT, null, 0);
but it won't make the application on PC2 connect to P3D on PC1. What is wrong with my settings? Thanks a lot!
PC1: With P3D installed. IPv4 address:192.168.10.139
PC2: A WPF application, need to remotely control P3D on PC1. IPv4 address:192.168.10.167
I think PC2 is the Sim server while PC1 is the Sim client. (Am I right?) According to the SDK instruction,
SimConnect.xml needs to be put on PC2 (sim server), under folder "C:\Program Files\Lockheed Martin\Prepar3D v4".
SimConnect.cfg needs to be put on PC1(sim client), under folder "C:\Users\Administrator\Documents".
I have modified these 2 files.
In SimConnect.xml:
<!-- Example Global (remote) IPv4 Server Configuration-->
<SimConnect.Comm>
<Disabled>False</Disabled>
<Protocol>IPv4</Protocol>
<Scope>global</Scope>
<MaxClients>64</MaxClients>
<Address>192.168.10.167</Address>
<Port>500</Port>
</SimConnect.Comm>
In SimConnect.cfg:
[SimConnect]
Protocol=IPv4
Address=192.168.10.167
Port=500
MaxReceiveSize=4096
DisableNagle=0
I also put SimConnect.ini under folder ".../Documents/Prepar3D v4 Files" for both PC1 and PC2 because the SDK Document says " the file should be placed in your %USERPROFILE%\Documents\Prepar3D v4 Files folder" but doesn't indicate the server or the client.
In SimConnect.ini:
[SimConnect]
level=verbose
console=Yes
;RedirectStdOutToConsole=Yes
;OutputDebugString=Yes
;file=c:\simconnect%03u.log
;file_next_index=0
;file_max_index=9
In the WPF application on PC2, I wrote
this.SimConnect = new SimConnect("Managed Data Request", Handle, WM_USER_SIMCONNECT, null, 0);
but it won't make the application on PC2 connect to P3D on PC1. What is wrong with my settings? Thanks a lot!
Re: SimConnect network configuration problem
The computer on which P3D is running (PC1 in your case) is the server.
Re: SimConnect network configuration problem
Why is this in the feature request forum??
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
Re: SimConnect network configuration problem
Hello
Topic moved to the the SimConnect Interface Questions sub-Forum
Topic moved to the the SimConnect Interface Questions sub-Forum
Elaine Dixon
Prepar3D® Forum Global Moderator
Forum Rules.....General Debugging Steps.....Installing\Updating\Uninstalling.....How to Post a Screenshot.....Activation Issues
Prepar3D® Forum Global Moderator
Forum Rules.....General Debugging Steps.....Installing\Updating\Uninstalling.....How to Post a Screenshot.....Activation Issues
-
- Posts: 58
- Joined: Fri Aug 18, 2017 1:04 am
Re: SimConnect network configuration problem
Thanks for the replies. Sorry I put it in the wrong place. And dsdawson thank you for indicating which is the server. But after I changed the IP address to 192.168.10.139 for both files it still cannot connect, the only difference is that when I click "connect" button, it took longer to respond.
Re: SimConnect network configuration problem
I am fairly certain (perhaps Elaine can confirm) that SimConnect.xml needs to be saved in Unicode format, not plain ASCII. That may be your issue.
-
- Posts: 58
- Joined: Fri Aug 18, 2017 1:04 am
Re: SimConnect network configuration problem
Hi dsdawson,
Thank you for the reply. Now my configuration files should be OK. But in the code, the statement "if (m.Msg == WM_USER_SIMCONNECT)" is never satisfied as shown below although "simconnect = new SimConnect("Managed Data Request", this.Handle, WM_USER_SIMCONNECT, null, 0)" can be executed with no exception or error reported. I think the client doesn't connect to P3D on the server but just connects to the server itself. Here is the code from 3 parts regarding my current problem:
//1.
const int WM_USER_SIMCONNECT = 0x0402;
//2.
simconnect = new SimConnect("Managed Data Request", this.Handle, WM_USER_SIMCONNECT, null, 0);
//why it can be executed although it doesn't connect to P3D on the server, because I closed P3D on the server it can still be executed
//3.
protected override void DefWndProc(ref Message m)
{
if (m.Msg == WM_USER_SIMCONNECT) //they are never equal, so I cannot read data, why???
{
if (simconnect != null)
{
simconnect.ReceiveMessage();
}
}
else
{
base.DefWndProc(ref m);
}
}
Thank you very much! I know this question might be too wide or vague...
Thank you for the reply. Now my configuration files should be OK. But in the code, the statement "if (m.Msg == WM_USER_SIMCONNECT)" is never satisfied as shown below although "simconnect = new SimConnect("Managed Data Request", this.Handle, WM_USER_SIMCONNECT, null, 0)" can be executed with no exception or error reported. I think the client doesn't connect to P3D on the server but just connects to the server itself. Here is the code from 3 parts regarding my current problem:
//1.
const int WM_USER_SIMCONNECT = 0x0402;
//2.
simconnect = new SimConnect("Managed Data Request", this.Handle, WM_USER_SIMCONNECT, null, 0);
//why it can be executed although it doesn't connect to P3D on the server, because I closed P3D on the server it can still be executed
//3.
protected override void DefWndProc(ref Message m)
{
if (m.Msg == WM_USER_SIMCONNECT) //they are never equal, so I cannot read data, why???
{
if (simconnect != null)
{
simconnect.ReceiveMessage();
}
}
else
{
base.DefWndProc(ref m);
}
}
Thank you very much! I know this question might be too wide or vague...
Re: SimConnect network configuration problem
I have to confess I don't know anything about C#, so I don't think I'll be much help with this.
Does the SimConnect log on the server indicate that your app is connecting?
Does the SimConnect log on the server indicate that your app is connecting?
Re: SimConnect network configuration problem
I don't think you will see anything returned to the proc unless you've requested something from the sim.
It doesn't just broadcast everything.
It doesn't just broadcast everything.
Ed Wilson
Senior Developer
Mindstar Aviation
Senior Developer
Mindstar Aviation
-
- Posts: 58
- Joined: Fri Aug 18, 2017 1:04 am
Re: SimConnect network configuration problem
Thank you very much!
I am not sure which "SimConnect log" you mean. As for the code, it is exactly the same provided by SDK examples which can read data via SimConnect on condition that the app (winform or wpf) and P3D are running on the same PC.
I also read requirements for P3D V3 although I am using V4, it does state "Ensure the EXE.xml, DLL.xml files and SimConnect.xml files are placed in... folder". So I put EXE.xml and DLL.xml onto the indicated location now which I didn't do before. Should all these 3 files be saved as "Encoding:Unicode"?
I am not sure which "SimConnect log" you mean. As for the code, it is exactly the same provided by SDK examples which can read data via SimConnect on condition that the app (winform or wpf) and P3D are running on the same PC.
I also read requirements for P3D V3 although I am using V4, it does state "Ensure the EXE.xml, DLL.xml files and SimConnect.xml files are placed in... folder". So I put EXE.xml and DLL.xml onto the indicated location now which I didn't do before. Should all these 3 files be saved as "Encoding:Unicode"?
Re: SimConnect network configuration problem
Regarding xml file encoding, see two detailed posts by Virtuali of FSDT on page 7 of this thread:
https://www.avsim.com/forums/topic/5113 ... v4/?page=7
Doug
https://www.avsim.com/forums/topic/5113 ... v4/?page=7
Doug
-
- Posts: 58
- Joined: Fri Aug 18, 2017 1:04 am
Re: SimConnect network configuration problem
Thanks! I already solved this - the problem is just that I misunderstood the path to put SimConnect.xml. Now the path is correct and the server and client are connected!