Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建 client 完全调用不了 service,不知道如何调试,求帮忙 #32

Open
ainitgit opened this issue Jun 21, 2019 · 3 comments

Comments

@ainitgit
Copy link

ainitgit commented Jun 21, 2019

服务端的创建代码是:
let hproseServer = require("hprose").Server.create('tcp://0.0.0.0:' + rpcPort.toString());
hproseServer.addFunction(WhenRPC, "WhenRPC");
hproseServer.start();
console.info("创建RPC Server", myName, rpcPort);

客户端的创建代码是:

require("hprose").Client.create('tcp://127.0.0.1:' + rpcPort.toString(), ["WhenRPC"])

function WhenRPC (args, callback) {
console.info("IN CallRPCAPI", args);
//callback(null, "ReceiveSuccess");
callback("ReceiveSuccess");
}
require("hprose").Client.WhenRPC("hello",function(){

})

rpcPort 是 Number 数字

@ainitgit
Copy link
Author

因为需求的原因,每个node进程 会用到 2个tcp端口,但是可以保证 互相独立的,绝对不会冲突

我在怀疑会不会是 多个端口的原因?

另外 server 被客户端连接的时候,有没有对应的 on 事件呢?

@andot
Copy link
Member

andot commented Jun 26, 2019

你是说你的 rpcPort 是个数组吗?那肯定不行。

另外,你客户端创建了,并没有看到调用。

@ainitgit
Copy link
Author

rpcPort 是数字
而且 代码也调用了
我知道 这样简单的例子 没法让你分析什么,但关键是 我的代码 确实就是非常简单的一段

所以有没有 对应的调试方法呢?让我知道 到底 是 client 链接不成功,还是 server 出错了

比如 client on error 事件?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants