parity_netPeers - 获取已连接的对等节点
parity_netPeers
调用返回已连接的对等节点,其中那些协议字段非空的节点已经
完成了协议握手过程。
调用参数
无
返回结果
parity_netPeers
调用返回一个对象,结构如下:
- active:活动的对等节点数量
- connected:已连接的对等节点数量
- max:对等节点的最大数量
- peers:对等节点详情数组
示例代码
请求:
~$ curl --data '{"method":"parity_netPeers","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
响应:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"active": 0,
"connected": 25,
"max": 25,
"peers": [{ ... }, { ... }, { ... }, ...]
}
}