/// <summary> /// 发送RSA密钥 /// </summary> /// <param name="m"></param> /// <param name="e"></param> public void SendRSAKey(byte[] m, byte[] e) { GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.RSAKey); pkg.Write(m); pkg.Write(e); SendTCP(pkg); }
public void SendRSAKey(byte[] m, byte[] e) { GSPacketIn pkg = new GSPacketIn(0); pkg.Write(m); pkg.Write(e); this.SendTCP(pkg); }
public void SendRSAKey(byte[] m, byte[] e) { GSPacketIn gSPacketIn = new GSPacketIn(0); gSPacketIn.Write(m); gSPacketIn.Write(e); this.SendTCP(gSPacketIn); }
/// <summary> /// 登陆 /// </summary> /// <param name="rsa"></param> /// <param name="name"></param> public void SendRSALogin(RSACryptoServiceProvider rsa, string key) { GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.LOGIN); pkg.Write(rsa.Encrypt(Encoding.UTF8.GetBytes(key), false)); SendTCP(pkg); }
public void SendRSALogin(RSACryptoServiceProvider rsa, string key) { GSPacketIn pkg = new GSPacketIn(1); pkg.Write(rsa.Encrypt(Encoding.UTF8.GetBytes(key), false)); this.SendTCP(pkg); }
public void LoginSocket() { string s = this.m_account + "," + this.InnerPwd; MemoryStream output = new MemoryStream(); byte[] data = new byte[8]; System.Random random = new System.Random(); using (BinaryWriter writer = new BinaryWriter(output)) { writer.Write((short)DateTime.UtcNow.Year); writer.Write((byte)DateTime.UtcNow.Month); writer.Write((byte)DateTime.UtcNow.Date.Day); writer.Write((byte)DateTime.UtcNow.Hour); writer.Write((byte)DateTime.UtcNow.Minute); writer.Write((byte)DateTime.UtcNow.Second); int[] numArray = new int[] { random.Next(0xff), random.Next(0xff), random.Next(0xff), random.Next(0xff), random.Next(0xff), random.Next(0xff), random.Next(0xff), random.Next(0xff) }; for (int i = 0; i < numArray.Length; i++) { writer.Write((byte)numArray[i]); data[i] = (byte)numArray[i]; } writer.Write(Encoding.UTF8.GetBytes(s)); } byte[] src = Rsa(output.ToArray()); GSPacketIn pkg = new GSPacketIn(1); pkg.WriteInt(ConfigMgr.Version); pkg.WriteInt(1); pkg.Write(src); this.SendTCP(pkg); this.setKey(data); UnityEngine.Debug.Log("{0} sending login socket...."); // this.lastErr = eErrorCode.DONE; }
public void SendListenIPPort(IPAddress ip, int port) { GSPacketIn pkg = new GSPacketIn(240); pkg.Write(ip.GetAddressBytes()); pkg.WriteInt(port); this.SendTCP(pkg); }
/// <summary> /// 发送监听端口和IP /// </summary> /// <param name="ip"></param> /// <param name="port"></param> public void SendListenIPPort(IPAddress ip, int port) { GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.IP_PORT); pkg.Write(ip.GetAddressBytes()); pkg.WriteInt(port); SendTCP(pkg); }
public void SendRSALogin(RSACryptoServiceProvider rsa, string key) { GSPacketIn pkg = new GSPacketIn(1); var x = rsa.Encrypt(Encoding.UTF8.GetBytes(key), false); pkg.WriteInt(x.Length); pkg.Write(x); var config = GameServer.Instance.Config; pkg.WriteInt(config.ServerID); pkg.WriteString(config.GameIP); pkg.WriteString(config.ServerName); pkg.WriteInt(config.GamePort); this.SendTCP(pkg); }