set the number of bytes transferred - if it has changed return True
353867
def set_bytes_transferred(self, bytes_transferred):
        '''  '''
        _changed = False
        if bytes_transferred:
            _changed = (self._bytes_transferred != int(bytes_transferred))
            if _changed:
                self._bytes_transferred = int(bytes_transferred)
                logger.debug("(%s) BytesTransferred: %d" % (
                             self.session_id, self._bytes_transferred))
            if AsperaSession.PROGRESS_MSGS_SEND_ALL:
                return True
        return _changed
818776
def changed_bytes(self, other):
        

        changes = set()

        l.warning("FastMemory.changed_bytes(): This implementation is very slow and only for debug purposes.")
        for addr,v in self._contents.items():
            for i in range(self.width):
                other_byte = other.load(addr+i, 1)
                our_byte = v.get_byte(i)
                if other_byte is our_byte:
                    changes.add(addr+i)

        return changes
563341
public boolean sendTCPBytes(ByteBuffer[] srcbuffers, int length)
    {
        boolean success = false;
        try
        {
            ByteBuffer header = createHeader(length);
            ByteBuffer[] buffers = new ByteBuffer[1 + srcbuffers.length];
            buffers[0] = header;
            for (int i = 0; i < srcbuffers.length; i++)
                buffers[i + 1] = srcbuffers[i];
            if (TCPUtils.isLogging())
            {
                long t1 = System.nanoTime();
                long bytesWritten = write(buffers);
                long t2 = System.nanoTime();
                double rate = 1000.0 * 1000.0 * 1000.0 * (double) (bytesWritten) / (1024.0 * (double) (t2 - t1));
                Log(Level.INFO, "Sent " + bytesWritten + " bytes at " + rate + " Kb/s");
            }
            else
            {
                write(buffers);
            }
            success = true;
        }
        catch (Exception e)
        {
            SysLog(Level.SEVERE, "Failed to send TCP bytes: " + e);
            try { channel.close(); } catch (IOException ioe) {}
        }
        return success;
    }
796658
def sendData(self, data):
        """"""
        # Not set up yet
        if self.client_log is None:
            self.client_log_buffer.append(data)
        else:
            self.client_log.write(data)
        self.transport.write(data)
123793
private static boolean byteSizeIsKnown(Collection<? extends UploadItem> uploadItems) {
        for (UploadItem uploadItem : uploadItems) {
            if (uploadItem.getSizeInBytes() == -1) {
                return false;
            }
        }
        return true;
    }
1196441
def sendTo(self, dest, chunkSize):
        
        vol = self.toVol
        paths = self.sink.getPaths(vol)

        if self.sink == dest:
            logger.info("Keep: %s", self)
            self.sink.keep(self)
        else:
            # Log, but don't skip yet, so we can log more detailed skipped actions later
            skipDryRun(logger, dest.dryrun, 'INFO')("Xfer: %s", self)

            receiveContext = dest.receive(self, paths)

            sendContext = self.sink.send(self)

            # try:
            #     receiveContext.metadata['btrfsVersion'] = self.btrfsVersion
            # except AttributeError:
            #     pass

            transfer(sendContext, receiveContext, chunkSize)

        if vol.hasInfo():
            infoContext = dest.receiveVolumeInfo(paths)

            if infoContext is None:
                # vol.writeInfo(sys.stdout)
                pass
            else:
                with infoContext as stream:
                    vol.writeInfo(stream)
1172459
public void setSentBytes(int newSentBytes)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setSentBytes", newSentBytes);
      sentBytes = newSentBytes;
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setSentBytes");
   }
187936
private void sendChunkSize() {
        if (chunkSizeSent.compareAndSet(false, true)) {
            log.debug("Sending chunk size: {}", chunkSize);
            ChunkSize chunkSizeMsg = new ChunkSize(chunkSize);
            conn.getChannel((byte) 2).write(chunkSizeMsg);
        }
    }
414303
def write(self, s, size=None):
        
        self._buffer.write(s)
        self._len_changed = True
1090510
@SdkInternalApi
    void updatePersistableTransfer(Integer lastFullyDownloadedPartNumber) {
        synchronized (this) {
            this.lastFullyDownloadedPartNumber = lastFullyDownloadedPartNumber;
        }

        persistableDownload = captureDownloadState(getObjectRequest, file);
        S3ProgressPublisher.publishTransferPersistable(progressListenerChain, persistableDownload);
    }
899660
def _update_session_count(self, type=0, actutal_session_count=0):
        ''' 
        '''
        if type == 0:  # init
            _count = 0
            if self._args.transfer_config:
                _count = self._args.transfer_config.multi_session
            self._session_count = _count if _count > 0 else 1
        elif type == -1:  # decrement
            self._session_count -= 1
        elif type == 1:  # set from number of actual session objects
            self._session_count = actutal_session_count
497474
def send(self):
        
        sent_chunks = 0
        chunk_num = self.index
        with open(self.filename, 'rb') as infile:
            infile.seek(self.index * self.chunk_size)
            while sent_chunks != self.num_chunks_to_send:
                chunk = infile.read(self.chunk_size)
                self._send_chunk(chunk, chunk_num)
                self.progress_queue.processed(1)
                chunk_num += 1
                sent_chunks += 1
953690
@Override
    public void transferProgressed(TransferEvent event) {
        TransferResource resource = event.getResource();

        long lastTransferred = downloads.get(resource);
        long transferred = event.getTransferredBytes();

        if (transferred - lastTransferred >= TRANSFER_THRESHOLD) {
            downloads.put(resource, Long.valueOf(transferred));
            long total = resource.getContentLength();
            log.finer(getStatus(transferred, total) + ", ");
        }
    }
128462
async def send_data(self):
        """"""
        self.connection._ensure_alive()
        conn = self.connection

        try:
            await self._open_file()
            with self._file_object:
                chunk_size = MAX_PACKET_LEN
                while True:
                    chunk = await self._file_read(chunk_size)
                    if not chunk:
                        break
                    # TODO: consider drain data
                    conn.write_packet(chunk)
        except asyncio.CancelledError:
            self.connection._close_on_cancel()
            raise
        finally:
            # send the empty packet to signify we are done sending data
            conn.write_packet(b"")
880574
private boolean setPrevious(byte[] sequence, int start, int length) {
    if (previous == null || previous.length < length) {
      previous = new byte[length];
    }

    System.arraycopy(sequence, start, previous, 0, length);
    previousLength = length;
    return true;
  }
92232
def _send_data(self, data):
        """"""
        total_sent = 0

        while total_sent < len(data):
            # Send only the bytes that haven't been
            # sent yet
            sent = self.socket.send(data[total_sent:].encode("ascii"))

            if sent == 0:
                self.close()
                raise RuntimeError("Socket connection dropped, "
                                   "send failed")
            total_sent += sent
881403
def send_bytes(self, bytes):
        
        try:
            self.socket.send(bytes)
            log.debug("TO PEER: %r\n", bytes)
        except socket.error:
            self.disconnect("Connection reset by peer.")