loading
 
Java API
Nachiket Londhe from United States  [7 posts]
7 years
I am using your API for java... and i am not able to connect it to roborealm its throws exception could not connect to local host 5050 !... can u give some suggestion on how to write initial connection code using RR_API.java and XML.java
Anonymous 7 years
I assume you are using the Java code provided in the API download?

Did you change the port to 5050? The default is 6060.

If your Java code does not work try telnet as in

telnet machine_name_or_ip_address 6060

and then paste in

<request><get_variable>IMAGE_NUM</get_variable></request>

to see if you get a response. This will ensure that RR is running and responding to API requests. If this all works out then something is going wrong in your Java code. Best to include it here in a zip so that everyone can test the actual code.

STeven.
Nachiket Londhe from United States  [7 posts] 7 years
i am trying to use the test.java code given in api folder. and while doing telnet what you think my machine name or ip would be my both softwares are on same machine... m attaching the code i have written, also the RR_API files has constructor which doesnt have definition body... so do you think its because of that.
Nachiket Londhe from United States  [7 posts] 7 years
i am trying to use the test.java code given in api folder. and while doing telnet what you think my machine name or ip would be my both softwares are on same machine... m attaching the code i have written, also the RR_API files has constructor which doesnt have definition body... so do you think its because of that.

also do yo uthink that i will be able to set values for ssc-32 added in roborealm using java and access variables such as CIRCLE_COUNT and CIRCLES in java.
MyClass.zip
Anonymous 7 years
Try

telnet localhost 5050

or

telnet 127.0.0.1 5050

and see if that works. Your code seems fine and should do the job.

Yes, you can set values for the ssc by using the rr.setVariable and putting those variables into the appropriate SSC channel.

Same with circle count (once a connection works) ... using

String circleCountStr = rr.getVariable("CIRCLE_COUNT")
int circleCount = Integer.parseInt(circleCountStr);

STeven.
Nachiket Londhe from United States  [7 posts] 7 years
hi STeven i tried both the telnet commands... it says could not open connection to the host , on port 5050 i guess thats why its not working with my code...
Anonymous 7 years
Ok, then you probably have not turned on the API server in RoboRealm? See the documentation on how to do that. Options button->API tab->etc.

How did you change the port from 6060 to 5050 without turning the API on?

STeven.
Nachiket Londhe from United States  [7 posts] 7 years
Hey Steven thanks,  got that working now the problem is how can i get array of circles which is name rr.getVariable("CIRCLES")

Anonymous 7 years
An array is returned as

number,number,number, etc.

So you would get back a long string from GetVariable which you would then need to parse using something like StringTokenizer.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index