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
- connect server
- keep asking until server there
- server says "yes i'm here, time 1:00"
- 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
Post a Comment