Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

IItem.NewLink() causes some Trouble with TCP connection

#1
Good day!
I am currently working on an interface between RoboDK and our software, which is a multithreading application designed to control multiple robots from RoboDK simultaneously.
The current situation is as follows: a RoboDK application is running on a remote computer, and I am connecting to it via TCP. However, the connection crashes when calling IItem.NewLink(). If I omit this function, the connection remains stable and works perfectly.

Attached is a snippet of my BeginConnection() () method.

I hope you can assist me with this issue. :)

Best Regards
Alex


Attached Files Image(s)
   
#2
Can you tell us more info about the exact error message you get?
Are you using the latest version of RoboDK?

Can you try with CloneRoboDKConnection instead?
https://github.com/RoboDK/RoboDK-API/blo...DK.cs#L474

I recommend you to create a new instance of RoboDK for each new thread instead. For example, you could choose
#3
Currently my logger is displaying:

RoboDk Robot Interface (0) connection terminated. Reason: RoboDk.API.Exceptions.RdkException: Invalid item provided: The item identifier provided is not valid or it does not exist. at RoboDk.API.RoboDK.check_status()

Maybe understanding the NewLink method from my perspective could solve this problem. Do I really need it?
#4
I would recommend you to avoid using the function FirstOrDefault. If this is executed on multiple threads it would explain the issue because you are requesting the robot Name.

Instead, you can simply get the robot by name by doing something like:
Code:
robot = RDK.getItem("robot name", ITEM_TYPE_ROBOT)
Also, does the issue happen the first time you go through your function or the second time?
I would avoid connecting and disconnecting if there is no robot available if you need to run this function multiple times.

If the issue persists, can you send us a sample project where we can see this issue? We can better take a look.
  




Users browsing this thread:
1 Guest(s)