/// <summary> /// poll response protocol /// +-------------------------------------------+ /// |OK:<POLL>:<fileContainerUri>:<fileBlobUri>| /// +-------------------------------------------+ /// </summary> /// <param name="msgPoll"></param> /// <returns></returns> public string pollRespMsg(string indicator, MsgPoll msgPoll) { string msg = "<" + indicator + ">:<POLL>:<" + msgPoll.fileContainerUri + ">:<" + msgPoll.fileBlobUri + ">" + ":<EOF>"; return msg; }
/// <summary> /// poll protocol /// +--------------------------+ /// |POLL:<userName>:<password>| /// +--------------------------+ /// </summary> /// <param name="msg"></param> /// <returns></returns> public MsgPoll pollParseMsg(string msg) { MsgPoll msgPoll = new MsgPoll(); string[] separators = { "<", ">:<", ">" }; string[] words = msg.Split(separators, StringSplitOptions.RemoveEmptyEntries); msgPoll.userName = words[1]; msgPoll.password = words[2]; msgPoll.nodeInfo = words[3]; return msgPoll; }