Soldat Democracy, a server admin I am working on is having troubles. I can send and receive data but I cannot get it to log in. I don't know the language the original soldat admin was wrote in but I got a lot of it figured out. One thing I cannot figure out it what order the commands are sent in. Here is what I have right now...
[code]
client = new TcpClient();
client.Connect(connectTo, port32);
Byte[] data = new Byte[256];
String connectData = String.Empty;
String responseData = String.Empty;
// read for connection
stream = client.GetStream();
Int32 bytes = stream.Read(data, 0, data.Length);
connectData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
MessageBox.Show(connectData); // this returns "Soldat Admin Connection Established..."
if(connectData.Substring(0,23) == "Soldat Admin Connection")
{
// insert password
data = System.Text.Encoding.ASCII.GetBytes(passWord);
stream.Write(data, 0, data.Length);
// read result
data = new Byte[256];
bytes = stream.Read(data, 0, data.Length);
responseData += System.Text.Encoding.ASCII.GetString(data, 0, bytes);
if(responseData.Substring(0,7) == "Invalid")
{
this.statusValue.Text = "Failed";
result = false;
connected = false;
}else{
this.statusValue.Text = "Connected";
result = true;
connected = true;
}
}else{
this.statusValue.Text = "Failed";
connected = false;
result = false;
}
MessageBox.Show(responseData); // this returns "Invalid server password. Cannot login"
[/code]
I know the password ip and ports are all valid. It has to be something with the order or methods used.
[code]
client = new TcpClient();
client.Connect(connectTo, port32);
Byte[] data = new Byte[256];
String connectData = String.Empty;
String responseData = String.Empty;
// read for connection
stream = client.GetStream();
Int32 bytes = stream.Read(data, 0, data.Length);
connectData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
MessageBox.Show(connectData); // this returns "Soldat Admin Connection Established..."
if(connectData.Substring(0,23) == "Soldat Admin Connection")
{
// insert password
data = System.Text.Encoding.ASCII.GetBytes(passWord);
stream.Write(data, 0, data.Length);
// read result
data = new Byte[256];
bytes = stream.Read(data, 0, data.Length);
responseData += System.Text.Encoding.ASCII.GetString(data, 0, bytes);
if(responseData.Substring(0,7) == "Invalid")
{
this.statusValue.Text = "Failed";
result = false;
connected = false;
}else{
this.statusValue.Text = "Connected";
result = true;
connected = true;
}
}else{
this.statusValue.Text = "Failed";
connected = false;
result = false;
}
MessageBox.Show(responseData); // this returns "Invalid server password. Cannot login"
[/code]
I know the password ip and ports are all valid. It has to be something with the order or methods used.