deivinsontejeda / protobuf

Example using protobuf to transfer data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Protocol Buffer

A very simple example using Protobuf protocol.

This example is composed by two sides a client which send serialized data using Protobuf protocol and server which receive it and decode to processing. For this example just send the input to standard output, but you can think instead of send to standard output could send to store a database.

Once you cloned this repositorie need get up the server (written in Go) which will decode messages sent by clients. This server listen on port 2110.

Install Protobuf & dependencies

Install Protobuf protocol compiler

brew install protobuf

More details about how to install Protobuf or further issue visit its oficial page

Install Go library

$ go get -u code.google.com/p/goprotobuf/...

Install protobuf gem to support compile .protoc files for Ruby.

$ gem install protobuf

How to run?

In a consola go to server folder and run follow command:

$ go run proto_serve.go

In another console run the clients which read a CSV file and send its content to server.

$ go run proto_client.go

You must see how client send messages and severs how decode them :)

Now, you can repeat the previous step but now running ruby client.

$ ruby client.rb

References

Happy Hacking!

About

Example using protobuf to transfer data.


Languages

Language:Go 78.3%Language:Ruby 21.7%