... | ... | @@ -106,7 +106,7 @@ std::cout << "Received request " << request->get() << std::endl; |
|
|
// Reply a string to the requester.
|
|
|
request->reply("Done");
|
|
|
```
|
|
|
|
|
|
The responder is created with the name "the-responder" to identify it.
|
|
|
Like the return value, it is possible to get the request as **binary** data using the *getBinary()* function or method. It is also possible to reply binary data using the *replyBinary()* method or function.
|
|
|
The requests can also be a **two-part message** and the second part can be get with the *getSecondBinaryPart()* method or function.
|
|
|
|
... | ... | @@ -116,7 +116,7 @@ try { |
|
|
// Connect to the app RespApp which hosts a responder.
|
|
|
Instance responderApp = server.connect("RespApp");
|
|
|
|
|
|
// Create a requester.
|
|
|
// Create a requester to the responder "the-responder".
|
|
|
Requester requester = Requester.create(responderApp, "the-responder");
|
|
|
System.out.println("Created requester " + requester);
|
|
|
|
... | ... | @@ -134,4 +134,12 @@ try { |
|
|
catch (RemoteException e) {
|
|
|
System.out.println("Requester error:" + e);
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
```
|
|
|
|
|
|
The requester is created by connecting to the responder named "the-responder" living in the "RespApp" application. Once connected, the requester can send requests and receive the responses.
|
|
|
|
|
|
The requester application can terminate unexpectedly whereas the responder is responding to it. In that case the responder may block indefinitely. That is why it is possible to set a timeout in milliseconds:
|
|
|
```cpp
|
|
|
request->setTimeout(1000);
|
|
|
```
|
|
|
|