public static seed_info UnPack(ByteArray reader) { seed_info tbl = new seed_info(); tbl.client_send_seed = reader.ReadInt32(); tbl.client_receive_seed = reader.ReadInt32(); return(tbl); }
// 交换dh密钥请求,将发送客户端公钥到服务器 public void GetSeedReq() { int sendSeed = NetCore.Instance.GetSendSeed(); int recvSeed = NetCore.Instance.GetReceiveSeed(); Proto.seed_info si = new Proto.seed_info(); si.client_receive_seed = recvSeed; si.client_send_seed = sendSeed; NetCore.Instance.Send(Api.ENetMsgId.get_seed_req, si); }
// 服务器返回密钥并加密连接 public object GetSeedAck(byte[] data) { Proto.ByteArray ba = new Proto.ByteArray(data); Proto.seed_info si = Proto.seed_info.UnPack(ba); ba.Dispose(); // 启用加密通讯 NetCore.Instance.Encrypt(si.client_send_seed, si.client_receive_seed); return(null); }
// 交换dh密钥请求,将发送客户端公钥到服务器 public void KeyExchangeReq() { int sendSeed = NetCore.Instance.GetSendSeed(); int recvSeed = NetCore.Instance.GetReceiveSeed(); Proto.seed_info si = new Proto.seed_info(); si.NetMsgId = (UInt16)Api.ENetMsgId.get_seed_req; si.client_receive_seed = recvSeed; si.client_send_seed = sendSeed; NetCore.Instance.Send(si); }
// 服务器返回公钥 public object KeyExchangeAck(byte[] data) { Proto.ByteArray ba = new Proto.ByteArray(data); Proto.seed_info si = Proto.seed_info.UnPack(ba); ba.Dispose(); // 启用加密通讯 NetCore.Instance.Encrypt(si.client_send_seed, si.client_receive_seed); // for testing action input return(si); }
// 交换dh密钥请求,将发送客户端公钥到服务器 public void KeyExchangeReq() { int sendSeed = NetCore.Instance.GetSendSeed(); int recvSeed = NetCore.Instance.GetReceiveSeed(); Proto.seed_info si = new Proto.seed_info(); si.NetMsgId = (Int16)Api.ENetMsgId.get_seed_req; si.client_receive_seed = recvSeed; si.client_send_seed = sendSeed; NetCore.Instance.Send(si); }
public static seed_info UnPack(ByteArray reader) { seed_info tbl = new seed_info(); tbl.client_send_seed = reader.ReadInt32(); tbl.client_receive_seed = reader.ReadInt32(); return tbl; }