OK, Sorry...
Firstly sorry about my English...
I have a project made in C that use protobuf-c-rpc to create a RPC procedures, that interfaces with others application in C normally.
Now I need to do an application in NodeJs that uses the same interface, I tried by using protobuf-rpc:
<CODE>
var express = require('express');
var app = express();
var ProtoBuf = require('protobufjs');
ProtoBuf.Rpc = require('protobuf-rpc');
var builder = ProtoBuf.loadProtoFile("ControllerMessage.proto");
var My_controller = builder.build('MyPackage');
var controller_svc = new ProtoBuf.Rpc(My_controller.Controller, {
transport: new ProtoBuf.Rpc.Transport.Xhr( {sync: true} ),
});
app.get('/have_pswd', function (req, res) {
var serv_req = new My_controller.Void();
controller_svc.HavePassword(serv_req, function(error, serv_res) {
if (error !== null)
return res.status(500).send('error');
res.json(serv_res);
});
});
var server = app.listen(9017, function(){
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
</CODE>
When I send a GET to localhost:9017/have_pswd, I have a error(500).
After that I tried by using grpc++:
protoc --proto_path=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ControllerMessage.proto
protoc --proto_path=. --cpp_out=. ControllerMessage.proto
<CODE>
#include <grpc++/grpc++.h>
#include "ControllerMessage.pb.h"
#include "ControllerMessage.grpc.pb.h"
int main (int argc, char* argv[])
{
std::unique_ptr<MyPackage::Controller::Stub>
stub(MyPackage::Controller::NewStub(
grpc::CreateChannel("localhost:5558", grpc::InsecureChannelCredentials())));
grpc::ClientContext cxt;
MyPackage::Void req;
MyPackage::Boolean res;
stub->HavePassword(&cxt, req, &res);
}
</CODE>
And on debug the line "stub->HavePassword(&cxt, req, &res);" make me wait forever.
I would like to know what I did wrong...
Thanks...