Can't make pb_sv_plist work?

Topics: Admin Tool, Developers
Jan 8, 2012 at 1:37 PM

Hi,

 

First of all ... NICE PROJECT!!!!! THANKS!!!! :)

 

I'm trying to  use pb_sv_plist, but it dosn't work. Here's my code...

 

System.Net.Battlefield3.RconClient _client = new System.Net.Battlefield3.RconClient();

_client.Address = "myIP";
_client.Port = myPort;
			
_client.Connected += new EventHandler((sender, e) => _client.LogOn("myPassword", true));
			
_client.PunkBusterMessage += delegate(object sender, System.Net.Battlefield3.PunkBusterMessageEventArgs e) {
	Console.WriteLine (e.Message);
};
			
_client.LoggedOn += delegate(object sender, EventArgs e) {
	_client.SendRequest("punkBuster.pb_sv_command", "pb_sv_plist");
};
			
_client.Connect();

 

I get a OK response back, but the list of clients are never returned.

Any idea why?

 

Thanks!!
Mojo 

 

Coordinator
Jan 8, 2012 at 3:49 PM
Edited Jan 8, 2012 at 3:50 PM

I don't currently have a server to test with, so I can't go in and check atm. I'll need you to check something for me, instead. :D

In the raw read event, do you see the plist after sending the command?

Also, do other PB commands work?

Jan 8, 2012 at 4:50 PM

Hi Timiz0r,

I only see "OK" in rawevent-words.

 

If I do this, then it works...

 

System.Net.Battlefield3.RconClient _client = new System.Net.Battlefield3.RconClient();

public override void ViewDidLoad () {
	_client.Address = "myIP";
	_client.Port = myPort;
			
	_client.Connected += new EventHandler((sender, e) => _client.LogOn("myPassword", true));
			
	_client.PunkBusterMessage += delegate(object sender, System.Net.Battlefield3.PunkBusterMessageEventArgs e) {
		Console.WriteLine ("CLIENT: " + e.Message);
	};
			
	_client.LoggedOn += delegate(object sender, EventArgs e) {
		this.InvokeOnMainThread (delegate {
			this._timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromMilliseconds(1), TimerOnTick);
		});
	};
			
	_client.Connect();
}


[Export("TimerOnTick")]
private void TimerOnTick() {
	this._timer.Invalidate ();
	this._timer = null;
	_client.SendRequest ("punkBuster.pb_sv_command", "pb_sv_plist");
}

Let me know if you need a server to test, I can give you access to mine :)

Mojo

Coordinator
Jan 8, 2012 at 6:09 PM

Since it works after a pause, it's either a weird bug in the library (probably due to a large amount of data) or an RCON bug where you can't use PB commands right after logon. To find out which one, can you try using pb_sv_ver right after logon and see if you get a response? If it ends up being server-side, a Thread.Sleep should work since the event is raised in a thread separate from other receives and the UI.

Also, I should have a server to test on soon. The one I was using missed a payment on accident D: