Jump to content

Communicator based on tcp protocol


Recommended Posts

 

Hi, 

I have written two programs client and server. The general idea is to make it a simple communicator on a local network to send three types of data string, 2 dimensional matrix and image + null message. For now the server sends data and the client receives. Ideally the two programs should be able to both receive and send data. However, I am most concerned about error 91 (Error 91 occurred at Variant To Data in CLIENT.vi). This may be related to the fact that when a timeout occurs, data is sent that the client does not know how to handle. How to maintain communication between the two applications? Probably this is something trivial that I can't see. I would appreciate your help. Programs are in this zip file.

tcp_communicator.zip

Link to comment
16 hours ago, betnow21 said:

make it a simple communicator

Simple, huh? :D 

16 hours ago, betnow21 said:

am most concerned about error 91 (Error 91 occurred at Variant To Data in CLIENT.vi)

That is a symptom, not the problem. You get that error because if there is a read error (your server shuts down the connection, read timeout or whatever), you still enqueue a message even when there is no data (and you have zero error handling).

Wire the error terminal on the "Producer" to the enqueue and it will reveal the real error (probably 66). This will ensure when there is an error, no data is enqueued to the upper loop which should be named the consumer-you have them switched. The TCP read Produces the data and your upper loop Consumes the data.

image.png.af8242258dc4e1a36c6e24c26bbb4228.png

 

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.