Q:

get data from beamng drive

using System;
using InSimDotNet.Out;
//In beamng go to settings -> other turn on OutGauge support
//Ip: 127.0.0.1(localhost) Port:4444
class Program {
    static void Main() {
        // Create timeout interval.
        TimeSpan timeout = TimeSpan.FromSeconds(10);

        // Create OutGauge object with the specified timeout.
        using (OutGauge outgauge = new OutGauge(timeout)) {
            // Attach event handler to packet-received event.
            outgauge.PacketReceived += outgauge_PacketReceived;
            outgauge.TimedOut += outgauge_TimedOut;

            // Start listening for packets from Beamng.
            outgauge.Connect("127.0.0.1", 4444);

            // Stop program from exiting while listening.
            Console.ReadLine();
        }
    }

    static void outgauge_TimedOut(object sender, EventArgs e) {
        Console.WriteLine("OutGauge timed out!");
    }

    static void outgauge_PacketReceived(object sender, OutGaugeEventArgs e) {
        // Handle packet.
        Console.WriteLine(e.RPM);
    }
}
0

New to Communities?

Join the community