Created basic listener for Xplane 11

This commit is contained in:
Luke Else 2022-02-17 16:36:55 +00:00
parent 48cfc08e06
commit a4f8f58804
3 changed files with 89 additions and 2 deletions

26
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net6.0/EFBTracker.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "externalTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/EFBTracker.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/EFBTracker.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/EFBTracker.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,2 +1,22 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
using System.Net;
using System.Net.Sockets;
using System.Text;
bool done = false;
int listenPort = 49003;
using(UdpClient listener = new UdpClient(listenPort))
{
IPEndPoint listenEndPoint = new IPEndPoint(2130706433, listenPort);
while(!done)
{
byte[] receivedData = listener.Receive(ref listenEndPoint);
Console.Clear();
Console.WriteLine("Received broadcast message from client {0}", listenEndPoint.ToString());
Console.WriteLine("Decoded data is:");
//Console.WriteLine(Encoding.ASCII.GetString(receivedData));
Console.WriteLine(BitConverter.ToString(receivedData));
}
}