Jump to content

data synchronization with TCP-IP blocks


Recommended Posts

Hi;

I have a basic client application with TCP IP blocks. The server side sends values and the client reads the values. I converted my client side into Labview dll and am calling it from my C++ application. My client dll is made up of three componnets: initialize, read and close. In my c++ code , first I call "initialize", then read the port in c++ while-loop continuously. However, since the server is in Labview, and the client is in c++, there is a difference in the rate of writing and reading data. Seems like I am writing (server side) faster than I read (client side) since when I change the value of a parameters to be sent by the server, I can see the change in the parameter on the client side after a couple of moments. However, my application dictates that I should read the value on the client side right away. In other words, I need to read the value of the parameter when it is called by the client and can ignore any intermediate values. I was wondering if there is anyone out there who can help with this.

My idea is maybe I can create a buffer on the server side which collects the parameters. As soon as the client send " I am ready signal" I can write the whole content of the buffer to the port so that the client can read the buffer and pick the value that was written last to the port, which is the value that I am interested in. I am not sure if this would be the easiest way though...

By the way, is there any way to know when the client requests info from the server. If I manage to pick up on that, then maybe I can count the number of loops between calls from my client to the server, and determine the amount of byte that has to be read by the client so that I can pick the value that I am interested from the whole data?

I feel pretty frustrated and would appreciate any help!

Kind Regards,

Link to comment

I converted my client side into Labview dll and am calling it from my C++ application.

Is there a reason you're not using C++ to read the TCP message?

My client dll is made up of three componnets: initialize, read and close.

I think we might be able to assist you better if you can post what you've done in your DLL.

By the way, is there any way to know when the client requests info from the server. If I manage to pick up on that, then maybe I can count the number of loops between calls from my client to the server, and determine the amount of byte that has to be read by the client so that I can pick the value that I am interested from the whole data?

You could send a timestamp with the request, however you'd have to synchonize the clocks at the client and server.

Tim

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.