Esempio n. 1
0
 public static void Create(SocketAsyncEventArgs args)
 {
     var token = new MessageReceiveToken();
     token.Args = args;
     token.Offset = args.Offset;
     args.UserToken = token;
 }
Esempio n. 2
0
 private void ProcessReceiveToken(MessageReceiveToken token)
 {
     token.ID = (ushort)((token.Header[0] << 8) | (token.Header[1]));
     token.Length = (token.Header[2] << 16) | (token.Header[3] << 8) | (token.Header[4]);
     token.Version = (ushort)((token.Header[5] << 8) | (token.Header[6]));
     token.Body = new byte[token.Length];
 }