CoreRCON 5.0.5

.NET Standard 2.0
Install-Package CoreRCON -Version 5.0.5
dotnet add package CoreRCON --version 5.0.5
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CoreRCON, 5.0.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.5 104 5/9/2022
5.0.3 116 4/20/2022
5.0.2 1,600 2/24/2021
5.0.0 1,235 9/22/2020
4.7.1 361 9/22/2020
4.7.0 1,446 5/26/2020
4.6.0 732 3/19/2020
4.5.1 1,088 12/8/2019
3.0.0 1,997 7/25/2017
2.0.0 1,135 12/11/2016
1.1.0 985 12/10/2016
1.0.1 908 11/26/2016
0.0.5 993 11/17/2016
0.0.4 845 11/14/2016
0.0.3 833 11/12/2016
0.0.2 1,369 11/8/2016
0.0.1 1,261 11/8/2016

Add OnPacketReceived event (#18)