コード例 #1
0
ファイル: SendDispatcher.cs プロジェクト: java02014/Blink
 public SendDispatcher(AutoQueue <SendPacket> queue,
                       ISender sender, ISendDelivery delivery)
 {
     mQueue    = queue;
     mSender   = sender;
     mDelivery = delivery;
 }
コード例 #2
0
ファイル: SocketAdapter.cs プロジェクト: java02014/Blink
        public bool SendEntity(SendPacket entity, ISendDelivery delivery)
        {
            int    cursor = 0;
            int    total  = entity.GetLength();
            Stream stream = entity.GetInputStream();
            int    count;

            try
            {
                while ((count = stream.Read(mOutBuffer, 0, mBufferSize)) != -1)
                {
                    // Write
                    mSocket.Send(mOutBuffer, 0, count, SocketFlags.None);
                    cursor += count;

                    // Post progress
                    delivery.PostSendProgress(entity, total, cursor);
                }
                return(true);
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                CloseStream(stream);
            }
            return(false);
        }
コード例 #3
0
        public BlinkConn(ISender sender, ISendDelivery sendDelivery, IReceiver receiver, IReceiveDelivery receiveDelivery, IResource resource)
        {
            mSender   = sender;
            mReceiver = receiver;
            mResource = resource;

            mSendDelivery    = sendDelivery;
            mReceiveDelivery = receiveDelivery;

            // Init this
            Init();
        }