상속: Message
예제 #1
0
        public static void EnqueueSendMessage(IConnection connection, IEncryption encryptor, PeerMessage message, IRateLimiter rateLimiter, ConnectionMonitor peerMonitor, ConnectionMonitor managerMonitor, AsyncIOCallback callback, object state)
        {
            int count = message.ByteLength;
            var buffer = ClientEngine.BufferManager.GetBuffer (count);
            message.Encode (buffer, 0);
            encryptor.Encrypt (buffer, 0, count);

            var data = sendCache.Dequeue ().Initialise (buffer, callback, state);
            NetworkIO.EnqueueSend (connection, buffer, 0, count, rateLimiter, peerMonitor, managerMonitor, EndSendCallback, data);
        }
예제 #2
0
 private void SendMessage(PeerMessage message, CustomConnection connection)
 {
     byte[] b = message.Encode();
     encryptor.Encrypt(b);
     IAsyncResult result = connection.BeginSend(b, 0, b.Length, null, null);
     if (!result.AsyncWaitHandle.WaitOne(5000, true))
         throw new Exception("Message didn't send correctly");
     connection.EndSend(result);
 }
예제 #3
0
 public MessageBundle(PeerMessage message)
     : this()
 {
     _messages.Add(message);
 }
예제 #4
0
 void SendMessage(PeerMessage message, CustomConnection connection)
 {
     byte[] b = message.Encode();
     encryptor.Encrypt(b);
     Send (connection, b, 0, b.Length);
 }
예제 #5
0
 public MessageBundle(PeerMessage message)
     : this()
 {
     _messages.Add(message);
 }