Client receive data from server
510972
function TcpClientData (buffer) {
    this.controller.Debug(7, "[%s] Data=[%s]", this.uid, buffer);
    // call adapter specific routine to process messages
    var status = this.adapter.ParseBuffer(this, buffer);
   
}
377002
public void receivedBytesRead(int bytes) {
        if (log.isDebugEnabled()) {
            log.debug("Client received {} bytes, written {} bytes, {} messages pending", new Object[] { bytes, getWrittenBytes(), getPendingMessages() });
        }
        clientBytesRead.addAndGet(bytes);
    }
1340071
public static function server_handle_receive($client_socket, $events, $arg)
    {
        $server = $arg[0];
        $client_id = $arg[1];
        $data = self::fread_stream($client_socket, $server->buffer_size);

        if ($data !== false) {
            $server->client->onReceive($client_id, $data);
        } else {
            $server->close($client_id);
        }
    }
88094
def data_received(self, data):
        """"""
        self.buffer += data.decode()
        self.log.debug('Received %d bytes from AVR: %s', len(self.buffer), self.buffer)
        self._assemble_buffer()
829639
def receive():
    
    header = _in_file.read(8)
    logging.getLogger(__name__).debug('Received command, header: [%s]' % header)
    if header is None or len(header) < 8:
        # Pipe EOF encountered
        logging.getLogger(__name__).debug('Pipe EOF encountered')
        return None, None
    length = int(header[2:])
    data = _in_file.read(length)
    command = CommandType(header[:2])
    data = data.decode('utf8')
    logging.getLogger(__name__).debug('Received command, data: [%s]' % data)
    return command, data
1311535
private void updateConnecting() throws IOException
    {
        if (clientId == -1)
        {
            // Receive id
            clientId = in.readByte();
            // Send the name
            out.writeByte(NetworkMessageSystemId.CONNECTING);
            out.writeByte(clientId);
            final byte[] data = clientName.getBytes(NetworkMessage.CHARSET);
            out.writeByte(data.length);
            out.write(data);
            out.flush();
            Verbose.info("Client: Performing connection to the server...");
        }
    }
1178914
def receive(self, data):
        
        self.log_debug("Received: %s" % (data))
        message =  self.make_message(data)
        self.trigger("receive", data=data, message=message)
        return message
87720
def receive(bytes)
      response = ""
      loop do
        if bytes <= @receive_buffer.bytesize
          array = @receive_buffer.bytes.to_a
          response = array[0..(bytes - 1)].pack('c*')
          @receive_buffer = array[(bytes)..-1].pack('c*')
          break
        end

        chunk = @connection.read_data
        if chunk.bytesize > 0
          @receive_buffer += chunk
        else
          sleep(0.1)
        end
      end
      @logger.debug("RX: #{unpack(response).inspect}")

      response
    end
414696
def data_received(self, data):
        """"""
        if self._on_data:
            self._on_data(data)
            return
        self._queued_data.append(data)
308757
def send_results(self, client, addr, results):
        
        json_results = json.dumps(results)
        json_results = json_results.encode()

        sent = 0
        total_len = len(json_results)
        got_error = False
        while (sent < total_len):
            this_sent = client.send(json_results[sent:])
            if this_sent == 0:
                got_error = True
                break
            sent += this_sent
        if got_error or sent != total_len:
            self.log_error("(%s:%s) Failed to send back results to client, "
                           "results: %s" % (addr[0], addr[1], json_results))
        else:
            self.log_debug("(%s:%s) Results sent back to client successfully."
                           % (addr[0], addr[1]))
1357758
function Client(server, conn){
  this.server = server;
  this.conn = conn;
  this.encoder = server.encoder;
  this.decoder = new server.parser.Decoder();
  this.id = conn.id;
  this.request = conn.request;
  this.setup();
  this.sockets = {};
  this.nsps = {};
  this.connectBuffer = [];
}
778794
def read(self, client):
        
        assert(isinstance(self._bytearray, DB))
        assert(self.row_size >= 0)
        db_nr = self._bytearray.db_number
        _bytearray = client.db_read(db_nr, self.db_offset, self.row_size)

        data = self.get_bytearray()
        # replace data in bytearray
        for i, b in enumerate(_bytearray):
            data[i + self.db_offset] = b
161989
public void sendData(byte[] data) throws ResponseException {
        if(con.isClosed()) return;

        Socket socket = null;
        try {
            socket = conHandler.createDataSocket();
            dataConnections.add(socket);
            OutputStream out = socket.getOutputStream();

            Utils.write(out, data, data.length, conHandler.isAsciiMode());
            bytesTransferred += data.length;

            out.flush();
            Utils.closeQuietly(out);
            Utils.closeQuietly(socket);
        } catch(SocketException ex) {
            throw new ResponseException(426, "Transfer aborted");
        } catch(IOException ex) {
            throw new ResponseException(425, "An error occurred while transferring the data");
        } finally {
            onUpdate();
            if(socket != null) dataConnections.remove(socket);
        }
    }
480451
def receive_data(socket):
    
    answer = b""
    while True:
        packet = socket.recv(4096)
        if not packet: break
        answer += packet
    response = pickle.loads(answer)
    socket.close()
    return response
1259027
public void getDataFromClient(HttpRequestBase httpget, OutputStream streamOut) throws ClientProtocolException, IOException
    {
    	HttpClient httpclient = new DefaultHttpClient();
    	     	 
    	 // Execute the request
    	 HttpResponse response = httpclient.execute(httpget);
    	 
    	 // Get the response entity
    	 HttpEntity entity = response.getEntity();
    	 
    	 if (entity != null)
    	 {
	    	 InputStream instream = entity.getContent();
	    	    	 
		     ProxyServlet.transferURLStream(instream, streamOut);
	
	         // Closing the input stream will trigger connection release
	         instream.close();
	    	         	     
	         // There is probably a less resource intensive way to do this.
	         httpclient.getConnectionManager().shutdown();
    	 }
    }
728635
def write(self, data):
        """"""
        # I don't want to add a separate 'Client disconnected' logic for sending.
        # Therefore I just ignore any writes after the first error - the server
        # won't send that much data anyway. Afterwards the read will detect the
        # broken connection and we quit.
        if self._ignore_write_operations:
            return
        assert self.is_connected()
        try:
            self._connection.send(data.encode('ascii'))
        except socket.error:
            self.close()
            self._ignore_write_operations = True
700334
def data_received(self, data):
        """"""
        self.tokenizer.feed(data)
        while self.tokenizer.has_tokens():
            raw = self.tokenizer.get_next_token()
            frame = frame_from_raw(raw)
            if frame is not None:
                self.frame_received_cb(frame)