Sha256: 08381cd394a0ea5651d1ffc1e3f14c46ce384bdeb15bf72505089513249406fb

Contents?: true

Size: 389 Bytes

Versions: 9

Compression:

Stored size: 389 Bytes

Contents

require 'socket'

module Protobuf
  module Rpc
    class Client
      def initialize(host, port)
        @host, @port = host, port
      end

      def call(name, request, response)
        socket = TCPSocket.open(@host, @port)
        socket.write "#{name}\n"
        request.serialize_to(socket)
        socket.close_write
        response.parse_from(socket)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby_protobuf-0.4.11 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.10 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.9 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.8 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.7 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.6 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.5 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.4 lib/protobuf/rpc/client.rb
ruby_protobuf-0.4.1 lib/protobuf/rpc/client.rb