public static GetMessageType ( byte byteArr ) : PCHC_MESSAGE_TYPE | ||
byteArr | byte | The payload. |
return | PCHC_MESSAGE_TYPE |
public static PCHC_MESSAGE_TYPE GetMessageType(byte[] byteArr)
{
int index = 0;
byte[] informationData = GetBytes(byteArr, ref index, byteArr.Length - index);
int tempIndex = 0;
PCHC_MESSAGE_TYPE msgType;
tempIndex = tempIndex + 2;
msgType = (PCHC_MESSAGE_TYPE)GetUInt16(informationData, ref tempIndex, false);
return msgType;
}
/// <summary> /// THe handle for the received http request event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">THe http request event.</param> private void ReceiveHttpRequest(object sender, HttpRequestEventArg e) { lock (this.locker) { HttpListenerRequest request = e.ListenerContext.Request; this.DecomposeHttpRequest(request); PCHC_MESSAGE_TYPE msgType = DecodeMessage.GetMessageType(this.httpRequestPayload); if (msgType == PCHC_MESSAGE_TYPE.INITIAL_OFFER_MESSAGE) { lock (this.initialQueue) { this.initialQueue.Enqueue(e.ListenerContext); } } else if (msgType == PCHC_MESSAGE_TYPE.SEGMENT_INFO_MESSAGE) { lock (this.segmentQueue) { this.segmentQueue.Enqueue(e.ListenerContext); } } } }