public string GET_KEY(Protocol_GET_KEY_REQ recvData)
        {
            Protocol_GET_KEY_ACK sendData = new Protocol_GET_KEY_ACK();
            sendData.nErrorCode = ErrorCode_GET_KEY.Success;
            sendData.szKey = MvcApplication.EncryptKey;

            return JsonConvert.SerializeObject(sendData);
        }
Ejemplo n.º 2
0
 void Send_GET_KEY_USE_PROTOCOL(Protocol_GET_KEY_REQ sendData)
 {
     JsonDotNetMessage message = new JsonDotNetMessage(IDTable[MessageID.GET_KEY_USE_PROTOCOL]);
     message.Data = sendData;
     session.Send(message);
 }
Ejemplo n.º 3
0
        void Start()
        {
            GameObject go = new GameObject("Session");
            session = go.AddComponent<Session>();
            session.onSend += OnSend;
            session.onReceive += OnReceive;
            session.onError += OnError;
            session.Connect("localhost", 4623);

            IDTable = new MessageIDTable();
            IDTable.AddID(MessageID.GET_KEY, "JsonNET/GET_KEY");
            IDTable.AddID(MessageID.LOGIN, "JsonNET/LOGIN");
            IDTable.AddID(MessageID.GET_KEY_USE_PROTOCOL, "JsonNETProtocol/GET_KEY");
            IDTable.AddID(MessageID.LOGIN_USE_PROTOCOL, "JsonNETProtocol/LOGIN");

            HandlerFunctionTable = new Dictionary<MessageID, MethodInfo>();
            foreach (var id in IDTable.IDs)
            {
                HandlerFunctionTable.Add(id, this.GetType().GetMethod(string.Format(HANDLER_FUNCTION_NAME, id), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance));
            }

            // 무명 클래스 이용
            //Send_GET_KEY("0.0.1");

            // 미리 정의된 프로토콜 클래스 이용
            Protocol_GET_KEY_REQ sendData = new Protocol_GET_KEY_REQ();
            sendData.szVersion = "0.0.1";
            Send_GET_KEY_USE_PROTOCOL(sendData);
        }