Connect to RPC Server. @param url The url of the host. @param port The port to connect to. @param key Additional key to match server. @return The connected session.
(String url, int port, String key)
| 32 | * @return The connected session. |
| 33 | */ |
| 34 | public static RPCSession connect(String url, int port, String key) { |
| 35 | Function doConnect = RPC.getApi("Connect"); |
| 36 | if (doConnect == null) { |
| 37 | throw new RuntimeException("Please compile with USE_RPC=1"); |
| 38 | } |
| 39 | TVMValue sess = doConnect.pushArg(url).pushArg(port).pushArg(key).invoke(); |
| 40 | return new RPCSession(sess.asModule()); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Connect to RPC Server. |