c++ - How to synchronize timers of two programs -


i making application have client , server. client send coordinates server use move robot. want synchronize timers, used time stamping log data, can compare input vs output. communication done through tcp/ip, , client done in c++ while server in rapid (abb robotic programming language). problem timers not synched properly.

right timers start when connection between 2 established:

server side: listenforconnection; starttimer;

client side: connecttoserver; starttimer;

this not work. there technique ensure timers synchronized?

nb: server can connected through lan.

you need protocol between client , server pass timestamp.

right now, presumably have protocol sending coordinates. need extend somehow allow 1 side send timer information other side.

the easiest if have 2 way communication capability. in case, client does

  1. connect server
  2. keep asking until server there
  3. server says "yes i'm here, time 1:00"
  4. the client starts sending coords

if server has no way send client, client needs send timestamp time time, server recognises being time, not coordinate. 2 not synched until happens first time.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -