Correct way of creating a networked RAPID application/module
After a day of diving really into RAPID and getting some test applications running I'm looking into the second big part of my application. For the project I'm working on I want to be able to send positions to the robot which to which is needs to move. All positions will lay on the same YZ-plane and are in the reach of the robot. I already got an application ready which can send these coordinates to a tcp/ip server.
Normally (with C/C++) I would either use a asynchronous socket or a separate thread in which I receive data and share received data using muteces to protect it. When using RAPID I'm not sure what the best way is to handle this data. I want the robot to move as fast as possible and as "real time" as possible. Can someone explain me roughly what I need to look into for this.
To give a bit more information... at this moment I'm thinking to use a simple binary protocol where I sent `messages` from my application to the robot. The first 4 bytes will hold the size of the message (big endian order) in bytes and once I receive a complete message I want to convert the received coordinates and use them with my robtargets. How can I read but not flush the first 4 bytes? And what would be the fastest/best solution to read numeric data?