public SendDispatcher(AutoQueue <SendPacket> queue, ISender sender, ISendDelivery delivery) { mQueue = queue; mSender = sender; mDelivery = delivery; }
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); }
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(); }