bytexdigital / bytexdigital.battleye.rcon Goto Github PK
View Code? Open in Web Editor NEWA simple to use RCON library for BattlEye
License: Apache License 2.0
A simple to use RCON library for BattlEye
License: Apache License 2.0
Hi,
I'm using your library (version 1.0.3-beta.4) in a .NET 6.0 project to control a DayZ server.
The client gets disconnected every 12 minutes and 56 seconds.
2021-12-13 16:13:55.532 INFO: Connected
2021-12-13 16:13:55.532 INFO: Server message: RCon admin #0 (127.0.0.1:57095) logged in
2021-12-13 16:26:51.629 INFO: Disconnected
2021-12-13 16:26:51.629 INFO: Connected
2021-12-13 16:26:51.630 INFO: Server message: RCon admin #1 (127.0.0.1:43417) logged in
2021-12-13 16:39:47.724 INFO: Disconnected
2021-12-13 16:39:47.725 INFO: Connected
2021-12-13 16:39:47.725 INFO: Server message: RCon admin #0 (127.0.0.1:38093) logged in
2021-12-13 16:52:43.832 INFO: Disconnected
2021-12-13 16:52:43.833 INFO: Connected
2021-12-13 16:52:43.833 INFO: Server message: RCon admin #1 (127.0.0.1:53917) logged in
2021-12-13 17:05:39.923 INFO: Disconnected
2021-12-13 17:05:39.923 INFO: Connected
2021-12-13 17:05:39.923 INFO: Server message: RCon admin #0 (127.0.0.1:49140) logged in
2021-12-13 17:18:36.013 INFO: Disconnected
2021-12-13 17:18:36.013 INFO: Connected
2021-12-13 17:18:36.014 INFO: Server message: RCon admin #1 (127.0.0.1:35456) logged in
Any idea what could be causing this?
Cheers
Phil
Hey,
opening the connection before the gameserver is ready (sometimes) seems to lead to multiple connections.
The code I'm using (excerpt):
try
{
RconClient beClient = new(server.Ip, server.Port, server.Password);
beClient.ReconnectInterval = 5000;
beClient.Connected += (sender, args) => NetworkClient_Connected(sender, args);
beClient.Disconnected += (sender, args) => NetworkClient_Disconnected(sender, args);
beClient.MessageReceived += (sender, args) => NetworkClient_MessageReceived(sender, args);
beClient.PlayerConnected += (sender, args) => NetworkClient_PlayerConnected(sender, args);
beClient.PlayerDisconnected += (sender, args) => NetworkClient_PlayerDisconnected(sender, args);
beClient.PlayerRemoved += (sender, args) => NetworkClient_PlayerRemoved(sender, args);
bool initialConnectSuccessful = beClient.Connect();
bool terminate = false;
while (!terminate)
{
beClient.WaitUntilConnected();
// [...]
// do some stuff...
// [...]
Thread.Sleep(restartDelay * 1000);
logger.Info("shutdown server...");
beClient.Send(new ShutdownCommand());
// the gameserver will be restarted by another program...
Thread.Sleep(30000);
}
}
catch (Exception ex)
{
logger.Error(ex.ToString());
}
program output:
2022-11-04 08:53:03.266 INFO: Connected
2022-11-04 08:53:03.468 INFO: Server message: RCon admin #0 (127.0.0.1:57631) logged in
2022-11-04 08:53:03.468 INFO: Server message: RCon admin #0 (127.0.0.1:57631) logged in
2022-11-04 08:53:03.890 INFO: Server message: RCon admin #1 (127.0.0.1:37491) logged in
2022-11-04 08:53:03.890 INFO: Server message: RCon admin #1 (127.0.0.1:37491) logged in
gameserver output:
8:53:03 Mission read.
8:53:03 Connected to Steam
8:53:03 Steam policy response
8:53:03 BattlEye Server: RCon admin #0 (127.0.0.1:57631) logged in
8:53:03 BattlEye Server: RCon admin #1 (127.0.0.1:37491) logged in
Both connections seem to be "alive", because both receive the NetworkClient_MessageReceived event (duplicates in program output).
However, one of those connections seems to "die", because after X seconds (can't tell exactly) there are no more duplicate log messages, just one per event (as expected).
Any ideas?
Thanks
GetMissionsRequest doese not realized
RconClient networkClient = new RconClient("192.168.1.1", 2344, "pswd");
bool requestSuccess = networkClient.Fetch(
command: new GetMissionsRequest(),
timeout: 5000,
result: out string missions);
InvalidOperationException
The library do not support cyrillic symbols.
The message sequence is reset to back to 0 before ever returning 255.
This causes the connection to abort periodically
Hey, anyone interested in helping out a noob here please?
I've got a little launcher setup in VS c# and im trying to connect to a Dayz server just to show how many players are online.
That's all I'm trying to do and i just cant get it to work hehe.. anyone able to share some coding which i can use to show online players in a textbox or label or something please?
It seems any kick results in an "Admin Kick". Can a reason be specified?
Yeah it seems like there is an issue in the BytexDigital.BattlEye.Rcon.NetworkConnection class.
Here is the full error:
Anwendung: EvoRCON.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.Net.Sockets.SocketException
bei System.Net.Sockets.Socket.DoBeginReceiveFrom(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint, System.Net.SocketAddress, System.Net.Sockets.OverlappedAsyncResult)
bei System.Net.Sockets.Socket.BeginReceiveFrom(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint ByRef, System.AsyncCallback, System.Object)
bei System.Net.Sockets.UdpClient.BeginReceive(System.AsyncCallback, System.Object)
bei System.Threading.Tasks.TaskFactory1[[System.Net.Sockets.UdpReceiveResult, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FromAsyncImpl(System.Func
3<System.AsyncCallback,System.Object,System.IAsyncResult>, System.Func2<System.IAsyncResult,System.Net.Sockets.UdpReceiveResult>, System.Action
1<System.IAsyncResult>, System.Object, System.Threading.Tasks.TaskCreationOptions)
bei System.Net.Sockets.UdpClient.ReceiveAsync()
bei BytexDigital.BattlEye.Rcon.NetworkConnection+d__21.MoveNext()
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
bei System.Threading.ThreadPoolWorkQueue.Dispatch()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.