Sha256: 4a1790ff1fc1d91294bdd01502b96cac37a7d06381ec49483cd8e15f68c1d791

Contents?: true

Size: 386 Bytes

Versions: 7

Compression:

Stored size: 386 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

7 entries across 7 versions & 2 rubygems

Version Path
macks-ruby_protobuf-0.3.2.1 lib/protobuf/rpc/client.rb
macks-ruby_protobuf-0.3.2.2 lib/protobuf/rpc/client.rb
macks-ruby_protobuf-0.3.2.3 lib/protobuf/rpc/client.rb
macks-ruby_protobuf-0.3.3 lib/protobuf/rpc/client.rb
ruby_protobuf-0.3.3 lib/protobuf/rpc/client.rb
ruby_protobuf-0.3.2 lib/protobuf/rpc/client.rb
ruby_protobuf-0.3.0 lib/protobuf/rpc/client.rb