Open FrozenHaxor opened 11 years ago
Do you have the error message for this? The stack trace could be helpful in fixing it.
I haven't worked on this code for quite some time and I haven't got either of a Windows or Linux machine to hand to reproduce the error myself.
Of course, I'll be glad to help you solve this issue!
Unhandled Exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex
at System.BitConverter.PutBytes (System.Byte* dst, System.Byte[] src, Int32 start_index, Int32 count) [0x00000] in <filename unknown>:0
at System.BitConverter.ToInt32 (System.Byte[] value, Int32 startIndex) [0x00000] in <filename unknown>:0
at SteamBot.RCONPacket.ParseFromBytes (System.Byte[] bytes, SteamBot.SourceRcon parent) [0x00000] in <filename unknown>:0
at SteamBot.SourceRcon.ProcessIncomingData (SteamBot.RecState state) [0x00000] in <filename unknown>:0
at SteamBot.SourceRcon.ReceiveCallback (IAsyncResult ar) [0x00000] in <filename unknown>:0
I would suggest adding a function to close the connection, like:
Sr.ServerCommand(cmd);
Sr.Close();
Since in all cases I have used SourceRcon, I just needed to send a command to a server without any care about the feedback.
You should try the dev branch, there's a Disconnect() function on that branch, the changes for which were never promoted to the stable branch for reasons I can't remember (as I may have mentioned, the last time I seriously worked on this was about 4 years ago) but will probably work ok. It also seems to implement the IDisposable pattern, so you could do:
using (Rcon Sr = new Rcon())
{
// Do stuff...
}
// Sr has been disconnected and cleaned up by here.
The sample command-line program uses this pattern. I'd help more, but I don't have the ability to run a Source dedicated server or Visual Studio at the moment, so I'm not confident I'll be able to test anything I write properly. I hope that helps.
Works fine so far, thanks! I had some problem including it into my current project, but everything seems to be alright for now.
You should just replace the current version with the dev, much better.
As the title says. To reproduce:
I believe this was mentioned in another Issue here. The game is Team Fortress 2.