LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP bidirectional communication

I have a problem using a server application and a client application to read and write data but I can not handle the information at the same time, im trying to do this to make a feedback control, can you help me please?
Download All
Message 1 of 8
(5,384 Views)
What exactly are you trying to accomplish? Some additional details about what you ultimately would like to accomplish would help. Does the client and server have to be sychronized? That is, do they need to wait for a response from the other before moving on to the next task? Are you simply trying to send data from one to the other for logging purposes or something like that? What type of bidirectional communication do you need?


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 8
(5,364 Views)
Your description is way too less. what are you trying to accomplish. ??
Regards
Asad Tirmizi
Design Engineer
Institute of Avionics and Aeronautics

" Its never too late to be, what u want to be"
Using LabVIEW 8.2
0 Kudos
Message 3 of 8
(5,353 Views)

Hi, thank you all for your observations. What I'm trying to do whit this vi's is to control a robot, I have two computers conected by a WiFi connection, using LV 8.5, the server sends the values of voltage to the client and the clinent sends the values to a DAQ 6009 and this manage the voltage values to the motors of the robot, I already did that, then I made two encoders to read the distance traveled, so now I want to send a value of distance instead a voltage value from the server, the client its continually reading the distance and I want this distance be received by the server to stop the movement instruction.

I dont knwo if I need to put an error condition on the TCP Listener to get this, or if is there another way to get this control please tell me how. Thank you.

Mensaje editado por Lunazuly
0 Kudos
Message 4 of 8
(5,335 Views)

It sounds like you need to develop a simple messaging protocol. I would recommend a basic message format that consists of a length, message ID and optional data field. The length should be a fixed length and can be 4 bytes. The message ID should also be a fixed length. You can decided if you want it to be an 8-bit, 16-bit or 32-bit value. In LabVIEW you will want to use an ENUM typedef for the message ID. The data field will be dependent on the message ID.

 

Both your server and client will use the message ID to determine the actions to be taken. This includes whether or not the message requires a response. To make things simple I would not allow the robot (client) to send messages to the server unless they are a response to a request. The server will send the desired message to the (client) robot and if required will listen for a response from the client. I would recommend using a state machine for both your client and server applications. This will make the message handling easier.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(5,329 Views)

Could yo be a little more specific or put an example of "message ID should also be a fixed length. You can decided if you want it to be an 8-bit, 16-bit or 32-bit value. In LabVIEW you will want to use an ENUM typedef for the message ID. The data field will be dependent on the message ID."

I'm not acquaintedwith the ENUM i already read the help about it but I don´t know how can I used as you said. Thank you.

Message 6 of 8
(5,314 Views)

Hello Friends,

 

I am new to the Labview, i need help to interage my labview vi inside the TCP Communicator - passive.vi you can find this vi inside the example Networking->Tcp & Udp->TCP communicator passive.vi.

 

I have genereated one more vi which you can find in attachment send_x_y.vi  Here i am generating a string from 2D array and i want to pass that string when i receive a message from robot studio that "send data" than and only than i want to send the data automatically and when again robot studio send a string "send data" than only than sedond data send . That means i want to wait unitl i got reply from the robot studio.

 

I am able to send the data one by one but i wan to make a loop that whenever i receive the string form robot studio "send data" than and only than i wan to send the data.

 

Here is the screen shot of my send_x_y.vi.

send x y.jpg

 

 

screen shot of TCP Passive.vi

 

TCP Passive.jpg

 

Thank you in advance for any help you can provide.

 

 



Download All
Message 7 of 8
(4,654 Views)

Both your send and receive should be in the same loop. Look at the examples for a state machine. You will basically want to wait on the receive for the command from your robot. Once you receive send the data and go back to waiting. This is an ideal candidate for a simple state machine.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 8
(4,642 Views)