CoreRCON 5.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package CoreRCON --version 5.0.5                
NuGet\Install-Package CoreRCON -Version 5.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreRCON" Version="5.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CoreRCON --version 5.0.5                
#r "nuget: CoreRCON, 5.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CoreRCON as a Cake Addin
#addin nuget:?package=CoreRCON&version=5.0.5

// Install CoreRCON as a Cake Tool
#tool nuget:?package=CoreRCON&version=5.0.5                

CoreRcon

Nuget Nuget

CoreRCON is an implementation of the RCON protocol on .NET Core. It currently supports connecting to a server, sending commands and receiving their output, multi-packat responses, and receiving logs from logaddress.

Supports:

Quick Start

Connect to an RCON server and send a command

The IP address supplied here is the server you wish to connect to.

using CoreRCON;
using CoreRCON.Parsers.Standard;
using System.Net;
// ...

// Connect to a server
var rcon = new RCON(IPAddress.Parse("10.0.0.1"), 27015, "secret-password");
await rcon.ConnectAsync();

// Send a simple command and retrive response as string
string respnose = await rcon.SendCommandAsync("echo hi");

// Send "status" and try to parse the response
Status status = await rcon.SendCommandAsync<Status>("status");

Console.WriteLine($"Connected to: {status.Hostname}");

Listen for chat messages on the server

This assumes you have been added to the server's logaddress list. You do not need to make an rcon connection to receive logs from a server.

The port specified must be open (check your router settings) and unused. Pass a value of 0 to use the first-available port. Access log.ResolvedPort to see which port it chose.

Finally, pass an array (or list of params) of IPEndPoints to express which servers you would like to receive logs from. This is because any server can send your server logs if they know which port you are listening on, as it's just UDP.

using CoreRCON;
using CoreRCON.Parsers.Standard;
// ...

// Listen on port 50000 for log packets coming from 10.0.0.1:27015
var log = new LogReceiver(50000, new IPEndPoint(IPAddress.Parse("10.0.0.1"), 27015));
log.Listen<ChatMessage>(chat =>
{
	Console.WriteLine($"Chat message: {chat.Player.Name} said {chat.Message} on channel {chat.Channel}");
});

Troubleshooting

Can't install via NuGet

"Could not install package 'CoreRCON X.X.X'. You are trying to install this package into a project that targets '.NETFramework,Version=vy.y.y', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."

If you are seeing an error similar to this, try changing your project's targeted .NET Framework version [#11]. If you are using Visual Studio 2015, the minimum resolvable framework version is 4.7. Visual Studio 2017 has improved support for .NET Core packages, allowing CoreRCON to resolve for versions as low as 4.6.1.

Changelog

Version 4.0.0

  • Rewrote RCON client to use Pipeline networking
  • Add support for multi-packet responses using Koraktors trick
  • ConnectAsync now has to be called after construction.

Version 3.0.0

Big thanks to ScottKaye for developing the original version

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CoreRCON:

Package Downloads
MinecraftConnectionCore

It is based on CoreRCON and extended for minecraft. This library can be used without being aware of asynchronous processing. It also provides basic minecraft commands, so that you can easily execute commands without knowing them.

WhiteList

A Plugin

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on CoreRCON:

Repository Stars
LANCommander/LANCommander
Version Downloads Last updated
5.4.2 415 11/1/2024
5.4.1 2,759 4/26/2024
5.4.0 1,569 2/18/2024
5.3.2 353 1/30/2024
5.3.1 245 1/24/2024
5.3.0 110 1/24/2024
5.2.1 1,443 10/30/2023
5.2.0 176 10/26/2023
5.1.0 281 10/5/2023
5.0.5 5,732 5/9/2022
5.0.3 534 4/20/2022
5.0.2 2,463 2/24/2021
5.0.0 1,930 9/22/2020
4.7.1 592 9/22/2020
4.7.0 1,720 5/26/2020
4.6.0 972 3/19/2020
4.5.1 1,348 12/8/2019
3.0.0 2,434 7/25/2017
2.0.0 1,488 12/11/2016
1.1.0 1,335 12/10/2016
1.0.1 1,224 11/26/2016
0.0.5 1,363 11/17/2016
0.0.4 1,186 11/14/2016
0.0.3 1,176 11/12/2016
0.0.2 1,722 11/8/2016
0.0.1 1,615 11/8/2016

Add OnPacketReceived event (#18)