[new AC] Data exchange fail between Java client and Java Agent ! [message #116178] |
Tue, 23 October 2007 10:31 |
Eclipse User |
|
|
|
Originally posted by: mlafon.arcadsoftware.removethis.com
I just try to use the TPTPJavaAgent with an modified version of the
SampleClientAC (I just change the name of the agent used to
JavatimeCollector), with TPTP 4.4.0.3.
After some work to config the agent... If the agent is not launched with
the good parameter this causes JVM crash, this can bereally confusing in
a deployment stage. Any way, I get the agent working and this is what I
get on the Client conseole :
Testing Agent Controler Server...
Connecting to Host localhost
Connecting to AC..
Connected to localhost at port number 10006
Connected to org.eclipse.tptp.JavaTimeCollector
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
The Data received from TimeCollector - JTC HELLO
Data Processor Waiting for Data Called
"JTC HELLO" is the data send by the agent, except that the agent send
"JTC HELLO FROM JTC ".
In fact, there is an conversion problem in the sendData :
super.sendData(destID,"JTC HELLO FROM JTC ".toCharArray());
the data are sent to the Native in the form of array of char (char in
java are 2 byte data, I gess ?).
The client get an incomingData with an array of byte and the lenght is
the lenght of the array of char, the HALF of the real byte array size.
To get all the data I need to double the string, something like this :
public int sendData(int targetInstanceId, String buffer)
throws AgentControllerUnavailableException {
// double string length
buffer = buffer + buffer;
return super.sendData(targetInstanceId, buffer.toCharArray());
}
And the client need to remove the last character of the received string :
public void incomingData(byte[] buffer, int length, InetAddress peer) {
String data = new String(buffer,0,length-1); // Remove last char !!!
...
}
This is working but this is ugly !
Finally, I get the answer of my previous question, the new Java API has
not been tested.
Marc.
|
|
|
|
Re: [new AC] Data exchange fail between Java client and Java Agent ! [message #116229 is a reply to message #116191] |
Tue, 23 October 2007 14:49 |
Eclipse User |
|
|
|
Originally posted by: mlafon.arcadsoftware.removethis.com
Hi Igor,
thank for your answer and your efforts in the TPTP Agent Controller
project.
I saw the bug report, I just forgot it :), by the way, except silly
remarks about testing, my post give a workaround if someone need it...
It looks like this bug is corrected in a patch and that patch is not
check-in because it contains a modification of the API ! an API that
does not work anyway... :p
Do you took a look at the bug report #207126 :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=207126
This is the reason why we are using data channel, my Java Agent can't
access to command bodies.
Marc.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04801 seconds