... | ... | @@ -109,3 +109,29 @@ request->reply("Done"); |
|
|
|
|
|
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.
|
|
|
|
|
|
Let's see an example of requester in Java:
|
|
|
```java
|
|
|
try {
|
|
|
// Connect to the app RespApp which hosts a responder.
|
|
|
Instance responderApp = server.connect("RespApp");
|
|
|
|
|
|
// Create a requester.
|
|
|
Requester requester = Requester.create(responderApp, "the-responder");
|
|
|
System.out.println("Created requester " + requester);
|
|
|
|
|
|
for (int i = 0; i < N; ++i) {
|
|
|
// Send a simple message as string.
|
|
|
requester.send("Message-" + i);
|
|
|
|
|
|
// Print the response.
|
|
|
System.out.println("Response is " + requester.receiveString());
|
|
|
}
|
|
|
|
|
|
// Terminate the requester.
|
|
|
requester.terminate();
|
|
|
}
|
|
|
catch (RemoteException e) {
|
|
|
System.out.println("Requester error:" + e);
|
|
|
}
|
|
|
``` |
|
|
\ No newline at end of file |