Exemplo n.º 1
0
 internal override void ReceiveAsync(AsyncBuffer buffer)
 {
     byte[] lengthBytes = new byte[4];
     base.Receive(lengthBytes);
     int dataSize = BitConverter.ToInt32(lengthBytes, 0);
     buffer.Resize(dataSize);
     base.Receive(buffer.data);
     Cipher.cipher(buffer.data, key);
     receiveThread[buffer.threadId] = null;
     buffer.Ready = true;
     buffer.RunCallback();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Starts a new thread to receive data to connected <see cref="CrosSocket"/>
 /// </summary>
 /// <param name="data">Data to send</param>
 public void CrosReceiveAsync(AsyncBuffer buffer)
 {
     buffer.Ready = false;
     Thread t = new Thread(new ParameterizedThreadStart(CReceiveAsync));
     receiveThread.Add(t);
     buffer.SetId(receiveThread.Count - 1);
     t.Start(buffer);
 }