The online racing simulator
No outgauge packets?
(2 posts, started )
No outgauge packets?
Hello everyone,

I have started developing an InSim application, and used the code given from InSimDotNet documentation.

using System;
using InSimDotNet.Out;

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 LFS.
outgauge.Connect("127.0.0.1", 30000);

// 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);
}
}

The thing is, I receive nothing. despite editing my CFG.txt file to this:

OutGauge Mode 1
OutGauge Delay 1
OutGauge IP 127.0.0.1
OutGauge Port 30000
OutGauge ID 0

What could I be doing wrong?
For me this piece of code has always been a headache.

// 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 LFS.
outgauge.Connect("127.0.0.1", 30000);

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

.
I replace it with this instead:

// Create OutGauge object with the specified timeout.
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 LFS.
outgauge.Connect("127.0.0.1", 30000);

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

By doing this you have to close the connection manually when your program exits.

No outgauge packets?
(2 posts, started )
FGED GREDG RDFGDR GSFDG