Jump to content
The simFlight Network Forums

Tuning radios on a networked client running FSX


Recommended Posts

Hello Pete,

 

I use registered and current FSUIPC4 and WideFS on a network of 10 computers:

(1) ONE Server PC (Win7-64): FSX SP2, WideviewX Server, FSUIPC4, WideFS Server: 7 touchscreen monitors, Saitek Yokes, Quadrants and Trim Wheel, CH Rudders, Saitek radio panels, Bodnar and Pokeys cards: used to generate 2-D cockpit panels exclusively. No scenery is displayed on the Server.

(2) SEVEN Client PC's (Win7-64): FSX SP2, WideviewX Client, FSUIPC4: each driving a widescreen monitor used to display outside scenery views exclusively, over a total 180 degrees fov. No cockpit panels are displayed and no joysticks are connected to these Clients.

(3) ONE Client PC (win7-64): FSX SP2, WideviewX Client, FSUIPC4, driving a widescreen monitor used to display an external Locked Spot view exclusively. No cockpit panels are displayed, and no joysticks are connected to this Client.

(4) ONE Client PC (WinVista-32): WideClient, Jeppesen Navigation Suite, Instructor Station, etc: driving 3 monitors, used for Jeppesen Nav tracking and wx injection. No joysticks here either.

 

This is with regard to pilot-activated runway lights on certain scenery add-ons; these are activated by tuning COM1/COM2 to certain frequencies. For instance, the new Aerosoft Ayers Rock X requires you to tune COM1 to 120.60 to activate the runway lights there.

 

On my system, tuning this frequency on the Server (where the Saitek radio panels are located) will not achieve this, because no scenery is displayed on my Server. I need to transmit this frequency to the Clients, i.e. each Client needs to sense that this frequency is being dialled locally by a local joystick.

 

Is there some way that FSUIPC/WideFS, perhaps in combination with a Lua script, could be used to transmit such information across the network to the clients?

 

I would like to consider two options: (i) Transmit the frequency from the Server to the 7+1 scenery Clients, by dialling the appropriate frequency on the Server hardware

(ii) Transmit the frequency from the Client PC not running FS [i.e. #(4) running on WinVista-32] to the 7+1 scenery Clients. This might be necessary if the frequency required to be dialled conflicts with what needs to be dialled on the Server for ATC comm/navigation purposes.

 

Thank you for your help and support, as always.

 

Warm Regards,

 

Chakko.

Link to comment
Share on other sites

This is with regard to pilot-activated runway lights on certain scenery add-ons; these are activated by tuning COM1/COM2 to certain frequencies. For instance, the new Aerosoft Ayers Rock X requires you to tune COM1 to 120.60 to activate the runway lights there.

 

On my system, tuning this frequency on the Server (where the Saitek radio panels are located) will not achieve this, because no scenery is generated on my Server. I need to transmit this frequency to the Clients, i.e. each Client needs to sense that this frequency is being dialled locally by a local joystick.

 

Is there some way that FSUIPC/WideFS, perhaps in combination with a Lua script, could be used to transmit such information across the network to the clients?

 

I would have expected WidevieW to provide cuch facilities, as it is the program coordinating all the PCs running FS.

 

WideClient as it stands won't rtun on a PC which is running FS. However, there is a work-around. You can set the ClassInstance parameter in its INI file to some non-zero value (eg 1). (In fact you can run several each with a different class instance). Such an installation won't run any FSUIPC applications, unless they've been modified to talk to the renamed window Class, but they will run Lua plug-ins.

 

However, if the PCs concerned are running FSUIPC, you don't need WideClient in any case. Just run the plug-ins in FSUIPC.

 

Write a Lua plug-in for the PC on which you are tuning the radio to react to COM radio frequency changes (event.offset), copy said frequency to a user offset (eg 0x66C0), then on the other, client, PC, a plug-in reacting to changes in the user offset and writing the result to the COM radio frequency offset.

 

Simpler, if it is a fixed frequency needed only, why not simply have a plug-in which writes that specific frequency when it sees a button (maybe a virtual one, set in an offset on another PC) pressed. There's no need to actually send frequencies when the ones you need are fixed.

 

Pete

Link to comment
Share on other sites

Dear Pete,

 

I am a novice at programming, but would like to try to write this plugin as a challenge.

 

Could you please clarify this for me, Pete: when offset 0x66C0 is written to on the Server through FSUIPC/lua, then the same offset is written to on the Client PC(s), without the involvement of WideFS? Or should I understand that the same offset can be accessed by the Client PC(s) without the involvement of WideFS?

 

Thank you for your time and patience.

 

Warm Regards,

 

Chakko.

Link to comment
Share on other sites

Could you please clarify this for me, Pete: when offset 0x66C0 is written to on the Server through FSUIPC/lua, then the same offset is written to on the Client PC(s), without the involvement of WideFS? Or should I understand that the same offset can be accessed by the Client PC(s) without the involvement of WideFS?

 

No. sorry. you misunderstand, or I wasn't clear. FSUIPC cannot communicate with FSUIPC on the other PC. You would need WideFS. But I thought the alternative of simply pressing a button on the client on which you want the frequency to change would be the easiest option. You only need to frequency change on that PC, right?

 

Pete

Link to comment
Share on other sites

Dear Pete,

Thank you for the clarification.

I should clarify that the frequency that I need to transmit to the clients will depend on the scenery add-on in question, so it is not just a single frequency or channel (NAV/COM) that needs to considered.

Also, as I have 7+1=8 client pc's generating scenery, I am looking for a semi-automated solution. Of course each of these 8 clients is also running FSUIPC alongside FS.

It appears to me that this might be a solution strategy:

(1) use WideClient on each of these 8 clients, using a non-zero ClassInstance parameter. I am familiar with this procedure. WideClient facilitates the transmission of the offset 0x66C0 to the clients.

(2) use Input Director macros to transmit key presses from the Server to the 8 clients (each running FSUIPC and WideClient) to trigger the Lua plugin you have suggested, locally on each Client.

Could you please comment on this?

Thank you ever so much.

Regards,

Chakko.

Link to comment
Share on other sites

Dear Pete,

Thank you for the clarification.

I should clarify that the frequency that I need to transmit to the clients will depend on the scenery add-on in question, so it is not just a single frequency or channel (NAV/COM) that needs to considered.

Also, as I have 7+1=8 client pc's generating scenery, I am looking for a semi-automated solution. Of course each of these 8 clients is also running FSUIPC alongside FS.

It appears to me that this might be a solution strategy:

(1) use WideClient on each of these 8 clients, using a non-zero ClassInstance parameter. I am familiar with this procedure. WideClient facilitates the transmission of the offset 0x66C0 to the clients.

(2) use Input Director macros to transmit key presses from the Server to the 8 clients (each running FSUIPC and WideClient) to trigger the Lua plugin you have suggested, locally on each Client.

 

You don't need anything to trigger a Lua plug-in if it is running in the WideClient folder. WideClient will load it initially. Using event.offset it can await a change to offset 0x66c0 then use the value to set the COM frequency.

 

If you need to send keypresses to a client, the built-in KeySend facilities in WideFS will do it. However, there's no need in this case.

 

Pete

Link to comment
Share on other sites

Hello Pete,

I wrote the following plugins:

 

on the Server (Modules folder): navcomtransmit.lua

 

function transmitCOM1(offset, value)

  COM1freq = ipc.readUW(0x034E)

  ipc.writeUW(0x66C0, COM1freq)

end

event.offset(0x034E, "UW", "transmitCOM1")

 

and on the Client (WideClient folder): navcomreceive.lua

 

function receiveCOM1(offset, value)

  COM1freq = ipc.readUW(0x66C0)

  ipc.writeUW(0x034E, COM1freq)

end

event.offset(0x66C0, "UW", "receiveCOM1")

 

I started FS on both Server and Client, established a WideFS connection, and logged these offsets on both Server and Client. On the Server, I could see changes in COM1 being copied into offset 66C0. However, there was no corresponding change on the Client, where offset 66C0 remained stuck at value: 0

 

I also inserted the line ipc.display(COM1freq) in navcomreceive.lua at the Client and found the frequencies changing appropriately. So the information is being transmitted across the network and received at the Client, but for some reason is not being transferred to FSX.

 

I am wondering if I have done everything necessary to establish a connection between WideClient and FSUIPC/FSX on the Client. Or is there something wrong with my script?

 

Looking forward to your comments.

 

Regards,

 

Chakko.

Link to comment
Share on other sites

on the Server (Modules folder): navcomtransmit.lua

 

function transmitCOM1(offset, value)

  COM1freq = ipc.readUW(0x034E)

  ipc.writeUW(0x66C0, COM1freq)

end

 

That one would be more efficient like this:

function transmitCOM1(offset, value)
  ipc.writeUW(0x66C0, value)
end

Silly reading the value again when it is supplied in the call! ;-).

 

Same for your receiving one.

function receiveCOM1(offset, value)
  ipc.writeUW(0x034E, value)
end
I started FS on both Server and Client, established a WideFS connection, and logged these offsets on both Server and Client. On the Server, I could see changes in COM1 being copied into offset 66C0. However, there was no corresponding change on the Client, where offset 66C0 remained stuck at value: 0

 

The client Lua will be started automatically by WideClient when it connects to the Server, but the sending Lua needs to be started in FSUIPC, either via ipcReady, or by an [Auto] section, or just by a keypress or button assignment.

 

I also inserted the line ipc.display(COM1freq) in navcomreceive.lua at the Client and found the frequencies changing appropriately. So the information is being transmitted across the network and received at the Client

 

But that flatly contrdicts what you just said, that 0x66C0 remained zero! It can't be both zero and contain the COM1 value! 

 

Maybe you need to Monitor both 66C0 and 034E on both machines, to the normal log, and show me the log!

 

I am wondering if I have done everything necessary to establish a connection between WideClient and FSUIPC/FSX on the Client.

 

I thought you said it connected okay. does WideClient show connection? Is the WideClient log looking normal?

 

Pete

Link to comment
Share on other sites

Hi Pete,

I'll trim the code and send you the logs soon.

The Client lua did start automatically on the Client, and I did use the [Auto] section to start the Server lua at the Server. I did monitor 66C0 and 034E on both machines. On the Server FSX, changing the COM1 frequency caused both offsets to change together. Just as they should. On the Client FSX the offset 034E was stuck at its initial value and 66C0 remained stuck at value 0.

When I added the line ipc.display(COM1freq) in the Client Lua, I forgot to mention that the Lua window opened on the Server FSX and showed the COM1freq changing appropriately. I was surprised at this, but I suppose this is because the WideClient at the Client is linked to the Server, i.e. in its wideclient.ini file (with ClassInstance1) the ServerName entered is SERVER. I just want to make sure I've done that right.

In fact what is puzzling to me is that the instance of WideClient opened at the Client is linked to the Server, so how would it communicate with FSX/FSUIPC locally at the Client?

Thank you for your patience, Pete.

Warm Regards,

Chakko.

Link to comment
Share on other sites

When I added the line ipc.display(COM1freq) in the Client Lua, I forgot to mention that the Lua window opened on the Server FSX and showed the COM1freq changing appropriately. I was surprised at this, but I suppose this is because the WideClient at the Client is linked to the Server,

 

Yes, ipc.display operates on the FS PC.

 

what is puzzling to me is that the instance of WideClient opened at the Client is linked to the Server, so how would it communicate with FSX/FSUIPC locally at the Client?

 

Ah. Of course. You are right. There's no way the WideClient can affect the client offsets. Sorry. It was me being stupid. My only excuse was that I was very busy here with visitors and had a lot on my mind too.

 

Actually, I can't think of any way to do what you need via WideFS without writing the frequency to a file in the Client Lua and have an FSUIPC-based Lua plug-in reading that file.

 

You might be better off using a network connection directly between two Lua plug-ins both running in the respective FSUIPC's -- in other words not using WideFS at all. There's an example of such communication provided in the Lua plug-ins package in your FSUIPC documents folder. Look at "MasterClient" and "SlaveServer". These are designed to make one PC running FS act as a slave, sim-wise, to the other, so they are doing much much more than you need. Just strip everything out and transmit only the COM frequency. No need for 66C0.

 

Note that those examples were written before the event library had been extended enough to make it all event driven. You can replace the infinite loop at the transmitting end with the event of COM1 frequency changing, and have the receiving end operating on an event.timer, not 5 mSecs as the current loop of course, but maybe 500.

 

Sorry for wasting your time leading you down a dead-end! Senior moment.

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

I am so grateful for the time you have taken out to help me learn so much more about FSUIPC and FSX.

 

 

Actually, I can't think of any way to do what you need via WideFS without writing the frequency to a file in the Client Lua and have an FSUIPC-based Lua plug-in reading that file.

 

You might be better off using a network connection directly between two Lua plug-ins both running in the respective FSUIPC's -- in other words not using WideFS at all. There's an example of such communication provided in the Lua plug-ins package in your FSUIPC documents folder. Look at "MasterClient" and "SlaveServer". These are designed to make one PC running FS act as a slave, sim-wise, to the other, so they are doing much much more than you need. Just strip everything out and transmit only the COM frequency. No need for 66C0.

 

Note that those examples were written before the event library had been extended enough to make it all event driven. You can replace the infinite loop at the transmitting end with the event of COM1 frequency changing, and have the receiving end operating on an event.timer, not 5 mSecs as the current loop of course, but maybe 500.

 

 

I thought I'd first attempt to modify your MasterClient and SlaveServer lua's before looking at the possibilities in keeping WideFS involved.

 

These are my (yet untested) modified versions of MasterClient and SlaveServer

 

-- "Master Client" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009
-- with modifications by CKOVOOR to transmit only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
local socket = require"socket"
 
-- Set the host name to the name of the PC running the Server
host = "SILVERZERO";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384"
 
function pass(...)
    local s = string.format(unpack(arg))
    io.stderr:write(s .. "\n")
end
 
local function fail(...)
    local s = string.format(unpack(arg))
    io.stderr:write("ERROR: " .. s .. "!\n")
socket.sleep(3)
    os.exit()
end
 
local function processdata()
COM1freq = ipc.readUW(0x034E)
COM2freq = ipc.readUW(0x3118)
NAV1freq = ipc.readUW(0x0350)
NAV2freq = ipc.readUW(0x0352)
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
s = "COM1=" .. COM1freq .. ",COM2=" .. COM2freq .. ",NAV1=" .. NAV1freq .. ",NAV2=" .. NAV2freq
 
-- now send it all in one string
  control:send(s .. "\n")
end
 
pass("attempting control connection...")
control, err = socket.connect(host, port)
if err then
fail(err)
else
pass("connected!")
end
control:setoption("tcp-nodelay", true)
 
 
event.offset(0x034E, "UW", "processdata")
event.offset(0x3118, "UW", "processdata")
event.offset(0x0350, "UW", "processdata")
event.offset(0x0352, "UW", "processdata")
 
 
******************************************************************************************
 
 
-- "Slave Server" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009
-- with modifications by CKOVOOR to receive only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
socket = require("socket");
 
-- Set the host name to the name of the PC running this Server
host = "SILVERZERO";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384";
 
 
local function processdata(command)
 
-- decode string, just numbers in order with non-number separators
w = string.gmatch(command, "[+-]?[0-9%.?]+")
COM1freq = w()
COM2freq = w()
NAV1freq = w()
NAV2freq = w()
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
-- now write it all in 
ipc.writeUW(0x034E, COM1freq)
ipc.writeUW(0x3118, COM2freq)
ipc.writeUW(0x0350, NAV1freq)
ipc.writeUW(0x0352, NAV2freq)
 
 
end
 
server = assert(socket.bind(host, port));
ack = "\n";
while 1 do
    print("server: waiting for client connection...");
    control = server:accept();
    if control ~= nil then
    print("server: client connected!");
    while 1 do 
        command = control:receive();
        if command == nil then
            print("server: client disconnected");
            ipc.control(65794) -- Pause FS
              break
        end
        assert(control:send(ack));      
        processdata(command)
    end
    end
end
 
****************************************************************************************
 
I'm looking forward to your comments, when you can find the time. 
 
Thank you ever so much, Pete.
 
Warmest Regards,
 
Chakko.
Link to comment
Share on other sites

I thought I'd first attempt to modify your MasterClient and SlaveServer lua's before looking at the possibilities in keeping WideFS involved.

 

These are my (yet untested) modified versions of MasterClient and SlaveServer

 

Best way to check is to try them. But first, remove the "local" prefix off the functions which are called by the event library -- the have to be non-local so the call can hook up from the event.

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

I removed the 'local' prefixes and ran the lua's at the Modules folder in Server and Client using FSUIPC [Auto], and then changed the COM1 frequencies at the Server, while monitoring offset 034E at both Server and Client. At the Server, 034E showed the appropriate changes, but there was no change at the Client.

 

Here are the lua's:

 

MasterClient at Server("SERVER"):

-- "Master Client" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009

-- with modifications to transmit only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
local socket = require"socket"
 
-- Set the host name to the name of the PC running the Server
host = "<SILVERZERO>";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384"
 
function pass(...)
    local s = string.format(unpack(arg))
    io.stderr:write(s .. "\n")
end
 
function fail(...)
    local s = string.format(unpack(arg))
    io.stderr:write("ERROR: " .. s .. "!\n")
socket.sleep(3)
    os.exit()
end
 
function processdata()
COM1freq = ipc.readUW(0x034E)
COM2freq = ipc.readUW(0x3118)
NAV1freq = ipc.readUW(0x0350)
NAV2freq = ipc.readUW(0x0352)
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
s = "COM1=" .. COM1freq .. ",COM2=" .. COM2freq .. ",NAV1=" .. NAV1freq .. ",NAV2=" .. NAV2freq
 
-- now send it all in one string
  control:send(s .. "\n")
end
 
pass("attempting control connection...")
control, err = socket.connect(host, port)
if err then
fail(err)
else
pass("connected!")
end
control:setoption("tcp-nodelay", true)
 
 
event.offset(0x034E, "UW", "processdata")
event.offset(0x3118, "UW", "processdata")
event.offset(0x0350, "UW", "processdata")
event.offset(0x0352, "UW", "processdata")
 

 

SlaveServer at Client("SILVERZERO")

-- "Slave Server" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009
-- with modifications to receive only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
socket = require("socket");
 
-- Set the host name to the name of the PC running this Server
host = "<SILVERZERO>";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384";
 
 
function processdata(command)
 
-- decode string, just numbers in order with non-number separators
w = string.gmatch(command, "[+-]?[0-9%.?]+")
COM1freq = w()
COM2freq = w()
NAV1freq = w()
NAV2freq = w()
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
-- now write it all in 
ipc.writeUW(0x034E, COM1freq)
ipc.writeUW(0x3118, COM2freq)
ipc.writeUW(0x0350, NAV1freq)
ipc.writeUW(0x0352, NAV2freq)
 
 
end
 
server = assert(socket.bind(host, port));
ack = "\n";
while 1 do
    print("server: waiting for client connection...");
    control = server:accept();
    if control ~= nil then
    print("server: client connected!");
    while 1 do 
        command = control:receive();
        if command == nil then
            print("server: client disconnected");
            ipc.control(65794) -- Pause FS
              break
        end
        assert(control:send(ack));      
        processdata(command)
    end
    end
end
 

 

and here are the logs:

FSUIPC log at Server("SERVER"):

********* FSUIPC4, Version 4.934a by Pete Dowson *********
Reading options from "E:\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
Running inside FSX on Windows 7
Module base=6C860000
User Name="Chakko Kovoor"
User Addr="ckovoor@alum.mit.edu"
FSUIPC4 Key is provided
WideFS7 Key is provided
      218 System time = 30/07/2014 21:47:22
      218 FLT UNC path = "\\SERVER\Flight Simulator X Files\"
      858 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      873 FS UNC path = "\\SERVER\Microsoft Flight Simulator X\"
     1981 Run: "C:\Program Files (x86)\IObit\Game Booster 3\GameBooster.exe -game"
     2355 Run: "C:\Program Files (x86)\CH Products\CMStart.exe"
     2433 Run: "C:\Program Files (x86)\SPAD\Spad.exe"
     2589 Run: "E:\Microsoft Flight Simulator X\FsRaas20\FsRaas20.exe"
     2667 Run: "C:\Program Files (x86)\AivlaSoft\EFB\AivlaSoft.Efb.DataProvider.exe"
     3401 Run: "E:\PILOTS_FSGRW_NETWORKBRIDGE\FS Global Real Weather Network Bridge.exe"
     3666 Run: "C:\Windows\System32\cmd.exe /c "net stop "audiosrv" & net start "audiosrv""
     3681 Run: "C:\Program Files (x86)\WinLayoutManager\WinLayoutManager.exe"
     4118 LogOptions=80000000 00000001
     4118 SIM1 Frictions access gained
     4134 Wind smoothing fix is fully installed
     4134 G3D.DLL fix attempt installed ok
     4134 SimConnect_Open succeeded: waiting to check version okay
     4134 Trying to use SimConnect Acc/SP2 Oct07
    11169 Running in "Microsoft Flight Simulator X", Version: 10.0.61472.0 (SimConnect: 10.0.61259.0)
    11169 Initialising SimConnect data requests now
    11169 FSUIPC Menu entry added
    11201 \\SERVER\Flight Simulator X Files\FSX Startup for Complex Aircraft.FLT
    11201 \\SERVER\Microsoft Flight Simulator X\SimObjects\Airplanes\Aircreation_582SL\Aircreation_582SL.AIR
    11513 Monitor IPC:034E (U16) = 0
    11513 Monitor IPC:66C0 (U16) = 0
    11825 Monitor IPC:034E (U16) = 10288
    11825 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
    33883 System time = 30/07/2014 21:47:55, Simulator time = 13:30:30 (20:30Z)
    34663 Aircraft="Aircreation582SL red"
    85722 \\SERVER\Microsoft Flight Simulator X\SimObjects\Airplanes\PMDG 737-800NGX\B737-800.AIR
    85722 C:\Users\Chakko Kovoor\Documents\Flight Simulator X Files\SUMUSGAS01.PLN
    85722 Weather Mode now = Global
    85722 \\SERVER\Flight Simulator X Files\B737 standard triple.FLT
    87626 Aircraft="Boeing 737-800NGX PMDG House"
    93054 Starting everything now ...
    93304 Advanced Weather Interface Enabled
   493759 Sim stopped: average frame rate for last 332 secs = 38.3 fps
   501559 Monitor IPC:034E (U16) = 6400
   501559 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   502120 Monitor IPC:034E (U16) = 10288
   502120 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   502682 Monitor IPC:034E (U16) = 6400
   502682 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   503228 Monitor IPC:034E (U16) = 10288
   503228 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   503789 Monitor IPC:034E (U16) = 6400
   503789 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   504413 Monitor IPC:034E (U16) = 10288
   504413 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
 

 

FSUIPC log at Client("SILVERZERO")

********* FSUIPC4, Version 4.934a by Pete Dowson *********
Reading options from "C:\FS Files\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
Running inside FSX on Windows 7
Module base=64460000
User Name="Chakko Kovoor"
User Addr="ckovoor@alum,mit.edu"
FSUIPC4 Key is provided
WideFS7 Key is provided
       15 System time = 30/07/2014 21:43:09
       15 FLT UNC path = "\\SILVERZERO\Users\Chakko Kovoor\Documents\Flight Simulator X Files\"
       47 Trying to connect to SimConnect Acc/SP2 Oct07 ...
       62 FS UNC path = "\\SILVERZERO\FS Files\Microsoft Flight Simulator X\"
      452 Run: "C:\FS Files\PILOTS_FSGRW_NETWORKBRIDGE\FS Global Real Weather Network Bridge.exe"
      827 LogOptions=00000000 00000001
      827 SIM1 Frictions access gained
      842 Wind smoothing fix is fully installed
      842 G3D.DLL fix attempt installed ok
      842 SimConnect_Open succeeded: waiting to check version okay
      842 Trying to use SimConnect Acc/SP2 Oct07
     3073 Running in "Microsoft Flight Simulator X", Version: 10.0.61472.0 (SimConnect: 10.0.61259.0)
     3073 Initialising SimConnect data requests now
     3073 FSUIPC Menu entry added
     3104 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\FLIGHTS\OTHER\FLTSIM.FLT
     3104 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\SimObjects\Airplanes\Aircreation_582SL\Aircreation_582SL.AIR
     4009 Monitor IPC:034E (U16) = 0
     4009 Monitor IPC:66C0 (U16) = 0
   130448 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\SimObjects\Airplanes\WidevieW_Dummy - PMDG B738NGX\WidevieW_Dummy.AIR
   130448 Weather Mode now = Global
   130448 \\SILVERZERO\Users\chakko kovoor\documents\flight simulator x files\WVD B737.FLT
   131259 Monitor IPC:034E (U16) = 10288
   131259 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   216919 Sim stopped: average frame rate for last 86 secs = 8.0 fps
   268322 System time = 30/07/2014 21:47:37, Simulator time = 09:06:00 (12:06Z)
   268322 Aircraft="WidevieW dummy PMDG B737-800 NGX"
   270318 Starting everything now ...
   272643 *** LUA Error: ...icrosoft Flight Simulator X\Modules\SlaveServer1.lua:36: Valid name, no data record of requested type
   330472 Sim stopped: average frame rate for last 62 secs = 12.2 fps
   332110 Advanced Weather Interface Enabled
   376103 Sim stopped: average frame rate for last 27 secs = 24.6 fps
   501995 Sim stopped: average frame rate for last 74 secs = 22.9 fps
   559373 Sim stopped: average frame rate for last 26 secs = 23.3 fps
 

I am not sure I have implemented all your suggestions in the lua's.

 

I look forward to our comments as and when you can find the time.

 

Thank you as always for your patience and help.

 

Warmest Regards,

 

Chakko.

Link to comment
Share on other sites

You didn't need to remove all the "local" prefices, only the one on the single function called by your events!

 

You didn't look through the logs and see this on the Client?

 

272643 *** LUA Error: ...icrosoft Flight Simulator X\Modules\SlaveServer1.lua:36: Valid name, no data record of requested type

 

Look at your "SlaveServer" line 36. Sorry, I can't count lines reliably in these messages.  I normally use an editor which gives line numbers.

 

Pete

Link to comment
Share on other sites

Hi Pete,

 

line 36 is:     server = assert(socket.bind(host, port))

 

I'm sorry I messed up on the 'local' removal. I wasn't sure about which to remove actually, so I removed all. I'll try again.

 

Thank you once again,

 

Chakko.

Link to comment
Share on other sites

I'm sorry I messed up on the 'local' removal. I wasn't sure about which to remove actually, so I removed all. I'll try again.

 

They don't matter. The local prefix just makes the code more efficient -- it saves the exporting of function names not referenced outside. Only the functions referred to in event functions cannot be local.

 

One observation, and this may well cause the error reported:

 

host = "<SILVERZERO>";

 

Does your server name really have <> parentheses around it? If not take them off!

 

The symbology "<servername>" simply denotes a place for the server name. The <x> parts are always to show this is a parameter you need to set. this is consistent throughout all my documentation (and many others, I should add).

 

Pete

Link to comment
Share on other sites

Hi Pete,

I cleaned up everything and ran the modified MasterClient-SlaveServer duo, and successfully established a connection! :grin:  :grin:

Then I changed the COM1 frequencies at the Server, while monitoring offset 034E at both Server and Client. At the Server, 034E showed the appropriate changes, but there was no change at the Client, so the offset is not being transmitted across the connection.

I am appending the Lua plugins, their respective logs, and the FSUIPC logs at Server and Client:

 

MasterClient1.lua at Server ("SERVER")

-- "Master Client" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009

-- with modifications by ckovoor to transmit only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
local socket = require"socket"
 
-- Set the host name to the name of the PC running the Server
host = "SILVERZERO";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384"
 
local function pass(...)
    local s = string.format(unpack(arg))
    io.stderr:write(s .. "\n")
end
 
local function fail(...)
    local s = string.format(unpack(arg))
    io.stderr:write("ERROR: " .. s .. "!\n")
socket.sleep(3)
    os.exit()
end
 
function processdata()
COM1freq = ipc.readUW(0x034E)
COM2freq = ipc.readUW(0x3118)
NAV1freq = ipc.readUW(0x0350)
NAV2freq = ipc.readUW(0x0352)
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
s = "COM1=" .. COM1freq .. ",COM2=" .. COM2freq .. ",NAV1=" .. NAV1freq .. ",NAV2=" .. NAV2freq
 
-- now send it all in one string
  control:send(s .. "\n")
end
 
pass("attempting control connection...")
control, err = socket.connect(host, port)
if err then
fail(err)
else
pass("connected!")
end
control:setoption("tcp-nodelay", true)
 
event.offset(0x034E, "UW", "processdata")
event.offset(0x3118, "UW", "processdata")
event.offset(0x0350, "UW", "processdata")
event.offset(0x0352, "UW", "processdata")
 
MasterClient1.log at Server
********* LUA: "MasterClient1" Log [from FSUIPC version 4.934a] *********
  1422963 System time = 31/07/2014 15:04:56, Simulator time = 09:12:44 (12:12Z)
  1422963 LUA: beginning "E:\Microsoft Flight Simulator X\Modules\MasterClient1.lua"
  1422963 LUA: attempting control connection...
 
  1422963 LUA: connected!
 
FSUIPC4.log at Server
********* FSUIPC4, Version 4.934a by Pete Dowson *********
Reading options from "E:\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
Running inside FSX on Windows 7
Module base=6D980000
User Name="Chakko Kovoor"
User Addr="ckovoor@alum.mit.edu"
FSUIPC4 Key is provided
WideFS7 Key is provided
      171 System time = 31/07/2014 14:41:13
      171 FLT UNC path = "\\SERVER\Flight Simulator X Files\"
      936 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      951 FS UNC path = "\\SERVER\Microsoft Flight Simulator X\"
     2028 Run: "C:\Program Files (x86)\IObit\Game Booster 3\GameBooster.exe -game"
     2496 Run: "C:\Program Files (x86)\CH Products\CMStart.exe"
     2574 Run: "C:\Program Files (x86)\SPAD\Spad.exe"
     2714 Run: "E:\Microsoft Flight Simulator X\FsRaas20\FsRaas20.exe"
     2808 Run: "C:\Program Files (x86)\AivlaSoft\EFB\AivlaSoft.Efb.DataProvider.exe"
     3369 Run: "E:\PILOTS_FSGRW_NETWORKBRIDGE\FS Global Real Weather Network Bridge.exe"
     3666 Run: "C:\Windows\System32\cmd.exe /c "net stop "audiosrv" & net start "audiosrv""
     3666 Run: "C:\Program Files (x86)\WinLayoutManager\WinLayoutManager.exe"
     4024 LogOptions=80000000 00000001
     4024 SIM1 Frictions access gained
     4040 Wind smoothing fix is fully installed
     4040 G3D.DLL fix attempt installed ok
     4040 SimConnect_Open succeeded: waiting to check version okay
     4040 Trying to use SimConnect Acc/SP2 Oct07
     9640 Running in "Microsoft Flight Simulator X", Version: 10.0.61472.0 (SimConnect: 10.0.61259.0)
     9656 Initialising SimConnect data requests now
     9656 FSUIPC Menu entry added
     9672 \\SERVER\Flight Simulator X Files\FSX Startup for Complex Aircraft.FLT
     9672 \\SERVER\Microsoft Flight Simulator X\SimObjects\Airplanes\Aircreation_582SL\Aircreation_582SL.AIR
    10030 Monitor IPC:034E (U16) = 0
    10342 Monitor IPC:034E (U16) = 10288
    10342 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
    36098 System time = 31/07/2014 14:41:49, Simulator time = 13:30:30 (20:30Z)
    36785 Aircraft="Aircreation582SL red"
    55832 \\SERVER\Microsoft Flight Simulator X\SimObjects\Airplanes\PMDG 737-800NGX\B737-800.AIR
    55832 C:\Users\Chakko Kovoor\Documents\Flight Simulator X Files\SUMUSGAS01.PLN
    55832 Weather Mode now = Global
    55832 \\SERVER\Flight Simulator X Files\B737 standard triple.FLT
    57190 Aircraft="Boeing 737-800NGX PMDG House"
    62088 Starting everything now ...
    62369 Advanced Weather Interface Enabled
   186951 Sim stopped: average frame rate for last 92 secs = 36.4 fps
   373466 Monitor IPC:034E (U16) = 6400
   373466 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   377553 Monitor IPC:034E (U16) = 10288
   377553 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   378115 Monitor IPC:034E (U16) = 6400
   378115 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   378567 Monitor IPC:034E (U16) = 10288
   378567 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   378973 Monitor IPC:034E (U16) = 6400
   378973 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   379488 Monitor IPC:034E (U16) = 10288
   379488 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   379956 Monitor IPC:034E (U16) = 6400
   379956 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   380439 Monitor IPC:034E (U16) = 10288
   380439 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   380923 Monitor IPC:034E (U16) = 6400
   380923 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   381422 Monitor IPC:034E (U16) = 10288
   381422 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   381968 Monitor IPC:034E (U16) = 6400
   381968 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   382498 Monitor IPC:034E (U16) = 10288
   382498 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   383169 Monitor IPC:034E (U16) = 6400
   383169 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   547142 Monitor IPC:034E (U16) = 10288
   547142 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   548312 Monitor IPC:034E (U16) = 6400
   548312 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 6400 (0x00001900)
   666124 Sim stopped: average frame rate for last 472 secs = 39.2 fps
   673050 C:\Users\Chakko Kovoor\Documents\Flight Simulator X Files\SUMUSGAS01.PLN
   673628 Monitor IPC:034E (U16) = 10288
   673628 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   749413 Monitor IPC:034E (U16) = 10277
   749413 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   750832 Monitor IPC:034E (U16) = 10288
   750832 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   751316 Monitor IPC:034E (U16) = 10277
   751316 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   751722 Monitor IPC:034E (U16) = 10288
   751722 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   752190 Monitor IPC:034E (U16) = 10277
   752190 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   752502 Monitor IPC:034E (U16) = 10288
   752502 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   753032 Monitor IPC:034E (U16) = 10277
   753032 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   753656 Monitor IPC:034E (U16) = 10288
   753656 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   754202 Monitor IPC:034E (U16) = 10277
   754202 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   760972 Sim stopped: average frame rate for last 83 secs = 32.6 fps
   806369 Sim stopped: average frame rate for last 42 secs = 38.0 fps
   810971 Aircraft="Boeing 737-800NGX PMDG House"
   842436 Sim stopped: average frame rate for last 24 secs = 39.7 fps
   849331 C:\Users\Chakko Kovoor\Documents\Flight Simulator X Files\SUMUSGAS01.PLN
   849909 Monitor IPC:034E (U16) = 10288
   849909 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   889580 Sim stopped: average frame rate for last 36 secs = 23.8 fps
   974834 Monitor IPC:034E (U16) = 10277
   974834 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   976800 Monitor IPC:034E (U16) = 10288
   976800 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   978765 Monitor IPC:034E (U16) = 10277
   978765 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   993913 Monitor IPC:034E (U16) = 10288
   993913 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   996019 Monitor IPC:034E (U16) = 10277
   996019 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
   998250 Monitor IPC:034E (U16) = 10288
   998250 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   998890 Monitor IPC:034E (U16) = 10277
   998890 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1000231 Monitor IPC:034E (U16) = 10288
  1000231 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1001074 Monitor IPC:034E (U16) = 10277
  1001074 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1075751 Sim stopped: average frame rate for last 143 secs = 39.5 fps
  1146123 Monitor IPC:034E (U16) = 10288
  1146123 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1150148 Monitor IPC:034E (U16) = 10277
  1150148 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1151505 Monitor IPC:034E (U16) = 10288
  1151505 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1152161 Monitor IPC:034E (U16) = 10277
  1152161 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1152457 Monitor IPC:034E (U16) = 10288
  1152457 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1152660 Monitor IPC:034E (U16) = 10277
  1152660 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1152863 Monitor IPC:034E (U16) = 10288
  1152863 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1153112 Monitor IPC:034E (U16) = 10277
  1153112 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1153315 Monitor IPC:034E (U16) = 10288
  1153315 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1153939 Monitor IPC:034E (U16) = 10277
  1153939 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1155655 Monitor IPC:034E (U16) = 10288
  1155655 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1156107 Monitor IPC:034E (U16) = 10277
  1156107 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1156451 Monitor IPC:034E (U16) = 10288
  1156451 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1156903 Monitor IPC:034E (U16) = 10277
  1156903 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1157262 Monitor IPC:034E (U16) = 10288
  1157262 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1157511 Monitor IPC:034E (U16) = 10277
  1157511 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1157823 Monitor IPC:034E (U16) = 10288
  1157823 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1158198 Monitor IPC:034E (U16) = 10277
  1158198 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1158650 Monitor IPC:034E (U16) = 10288
  1158650 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
  1159118 Monitor IPC:034E (U16) = 10277
  1159118 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1199211 Monitor IPC:034E (U16) = 10304
  1199211 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10304 (0x00002840)
  1201129 Monitor IPC:034E (U16) = 10277
  1201129 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1202159 Monitor IPC:034E (U16) = 10304
  1202159 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10304 (0x00002840)
  1212049 Monitor IPC:034E (U16) = 10277
  1212049 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1212720 Monitor IPC:034E (U16) = 10304
  1212720 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10304 (0x00002840)
  1213953 Monitor IPC:034E (U16) = 10277
  1213953 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1215419 Monitor IPC:034E (U16) = 10304
  1215419 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10304 (0x00002840)
  1250114 Sim stopped: average frame rate for last 114 secs = 40.6 fps
  1310439 Monitor IPC:034E (U16) = 10277
  1310439 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1313809 Sim stopped: average frame rate for last 54 secs = 40.4 fps
  1444974 Monitor IPC:034E (U16) = 9024
  1444974 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1445037 Monitor IPC:034E (U16) = 10277
  1445037 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1450575 Monitor IPC:034E (U16) = 9024
  1450575 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1453102 Monitor IPC:034E (U16) = 10277
  1453102 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1456019 Monitor IPC:034E (U16) = 9024
  1456019 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1456581 Monitor IPC:034E (U16) = 10277
  1456581 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1456971 Monitor IPC:034E (U16) = 9024
  1456971 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1457423 Monitor IPC:034E (U16) = 10277
  1457423 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1467844 Monitor IPC:034E (U16) = 9024
  1467844 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1469186 Monitor IPC:034E (U16) = 10277
  1469186 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1469607 Monitor IPC:034E (U16) = 9024
  1469607 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1469888 Monitor IPC:034E (U16) = 10277
  1469888 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1470184 Monitor IPC:034E (U16) = 9024
  1470184 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1567794 Monitor IPC:034E (U16) = 10277
  1567794 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1569307 Monitor IPC:034E (U16) = 9024
  1569307 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 9024 (0x00002340)
  1570961 Monitor IPC:034E (U16) = 10277
  1570961 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10277 (0x00002825)
  1571975 Monitor IPC:034E (U16) = 9024

 

SlaveServer1.lua at Client ("SILVERZERO")

-- "Slave Server" example LUA plug-in (MODIFIED), by Pete Dowson, October 2009

-- with modifications by ckovoor to receive only COM and NAV frequencies
-- To make the Server FS act as a slave, following the Client FS acting as Master
 
-- The SOCKET module is built into FSUIPC, but is not active until "required"
socket = require("socket");
 
-- Set the host name to the name of the PC running this Server
host = "SILVERZERO";
 
-- The port must match the port selected in the client and not clash with others.
port = "8384";
 
 
function processdata(command)
 
-- decode string, just numbers in order with non-number separators
w = string.gmatch(command, "[+-]?[0-9%.?]+")
COM1freq = w()
COM2freq = w()
NAV1freq = w()
NAV2freq = w()
 
-- This simply sets the aircraft COM and NAV frequencies
-- according to the parameters received
 
-- now write it all in 
ipc.writeUW(0x034E, COM1freq)
ipc.writeUW(0x3118, COM2freq)
ipc.writeUW(0x0350, NAV1freq)
ipc.writeUW(0x0352, NAV2freq)
 
end
 
server = assert(socket.bind(host, port));
ack = "\n";
while 1 do
    print("server: waiting for client connection...");
    control = server:accept();
    if control ~= nil then
    print("server: client connected!");
    while 1 do 
        command = control:receive();
        if command == nil then
            print("server: client disconnected");
            ipc.control(65794) -- Pause FS
              break
        end
        assert(control:send(ack));      
        processdata(command)
    end
    end
end
 
SlaveServer1.log at Client
********* LUA: "SlaveServer1" Log [from FSUIPC version 4.934a] *********
   396835 System time = 31/07/2014 14:43:00, Simulator time = 09:10:00 (12:10Z)
   396835 LUA: beginning "C:\FS Files\Microsoft Flight Simulator X\Modules\SlaveServer1.lua"
   396851 LUA: server: waiting for client connection...
  1202065 LUA: server: client connected!
  1218617 LUA: server: client disconnected
  1218648 LUA: server: waiting for client connection...
  1218648 LUA: server: client connected!
  1497500 LUA: server: client disconnected
  1497516 LUA: server: waiting for client connection...
  1501291 LUA: server: client connected!
  1503023 LUA: server: client disconnected
  1503038 LUA: server: waiting for client connection...
  1503038 LUA: server: client connected!
 
FSUIPC4.log at Client
********* FSUIPC4, Version 4.934a by Pete Dowson *********
Reading options from "C:\FS Files\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
Running inside FSX on Windows 7
Module base=645C0000
User Name="Chakko Kovoor"
User Addr="ckovoor@alum,mit.edu"
FSUIPC4 Key is provided
WideFS7 Key is provided
       15 System time = 31/07/2014 14:36:23
       15 FLT UNC path = "\\SILVERZERO\Users\Chakko Kovoor\Documents\Flight Simulator X Files\"
       47 Trying to connect to SimConnect Acc/SP2 Oct07 ...
       47 FS UNC path = "\\SILVERZERO\FS Files\Microsoft Flight Simulator X\"
      437 Run: "C:\FS Files\PILOTS_FSGRW_NETWORKBRIDGE\FS Global Real Weather Network Bridge.exe"
      624 LogOptions=80000000 00000001
      624 SIM1 Frictions access gained
      624 Wind smoothing fix is fully installed
      624 G3D.DLL fix attempt installed ok
      624 SimConnect_Open succeeded: waiting to check version okay
      624 Trying to use SimConnect Acc/SP2 Oct07
     2745 Running in "Microsoft Flight Simulator X", Version: 10.0.61472.0 (SimConnect: 10.0.61259.0)
     2745 Initialising SimConnect data requests now
     2745 FSUIPC Menu entry added
     2777 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\FLIGHTS\OTHER\FLTSIM.FLT
     2777 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\SimObjects\Airplanes\Aircreation_582SL\Aircreation_582SL.AIR
     3510 Monitor IPC:034E (U16) = 0
   105519 \\SILVERZERO\FS Files\Microsoft Flight Simulator X\SimObjects\Airplanes\WidevieW_Dummy - PMDG B738NGX\WidevieW_Dummy.AIR
   105519 Weather Mode now = Global
   105519 \\SILVERZERO\Users\chakko kovoor\documents\flight simulator x files\WVD B737.FLT
   106346 Monitor IPC:034E (U16) = 10288
   106346 SimRead: 034E="COM ACTIVE FREQUENCY:1"
            INT32: 10288 (0x00002830)
   106346 Aircraft="WidevieW dummy PMDG B737-800 NGX"
   106346 System time = 31/07/2014 14:38:10, Simulator time = 11:48:48 (04:48Z)
   396835 Starting everything now ...
   396944 Advanced Weather Interface Enabled
   447816 Sim stopped: average frame rate for last 54 secs = 12.3 fps
   753531 Sim stopped: average frame rate for last 281 secs = 24.1 fps
   929812 Sim stopped: average frame rate for last 176 secs = 23.8 fps
  1202112 Monitor IPC:034E (U16) = 1
  1665794 Sim stopped: average frame rate for last 736 secs = 23.4 fps
  1666668 \\SILVERZERO\Users\Chakko Kovoor\AppData\Roaming\Microsoft\FSX\Previous flight.FLT
  2137260 Sim stopped: average frame rate for last 335 secs = 24.0 fps
 

I look forward to your comments when you can find the time to look at these.

Thank you ever so much for your patience.

Warm Regards,

Chakko.

Link to comment
Share on other sites

I am appending the Lua plugins, their respective logs, and the FSUIPC logs at Server and Client:

 

One thing I notice is that the receiver is logging several connections and disconnections, whilst the sender simply logs the connection the once, because the code that does that is only ever executed once. Maybe things are different when only doing periodic transmissions -- the programs you derived this from were constantly sending data, many times per second. Not sure why the disconnect/reconnects are occurring. Maybe there's some timeout. 

 

Is anything received? Maybe it times out / disconnects first?

 

Why not add some logging into the receiver, for instance log the string you receive? I really cannot diagnose things remotely. You could also try using the Lua trace option on the Logging page -- but note you need to enable then BEFORE the plug-in is started.

 

Pete

Link to comment
Share on other sites

Hi Pete,

No, the multiple disconnections/reconnections were myself just toggling the (fsuipc) button controlling the plugin at the server. The lua connection is actually itself quite stable. I anticipated this question, and perhaps I should have clarified this with my earlier message.

I shall do as you suggest, and of course I understand the difficulty you would have in trying to diagnose the problem. But I was just wondering if the modified script is okay, at least superficially. For instance, is it appropriate that I transmit the offsets as a string, etc? Or have I deleted some essential part of the earlier script?

Regards,

Chakko.

Link to comment
Share on other sites

I shall do as you suggest, and of course I understand the difficulty you would have in trying to diagnose the problem. But I was just wondering if the modified script is okay, at least superficially. For instance, is it appropriate that I transmit the offsets as a string, etc? Or have I deleted some essential part of the earlier script?

 

 

I haven't checked the code line-by-line in detail, it just looks like a straight conversion for my originals. I'm a bit busy at present -- we off on holiday for two weeks from 0600 on Saturday and I have preparation to do, so the amount of time I can spend is limited I'm afraid. Sorry.

 

Strings are easier for you to see, when logged for instance, and so interpret. Obviously binary data would be more compact but with such a small amount of data so infrequently it is probably best to make it simple for you to recognise. Decoding should work okay with those functions used, but first log what is received to make sure that part is okay.

 

Pete

Link to comment
Share on other sites

  • 3 weeks later...

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.