02-21-2023 11:01 AM
Hi,
please i would like to know if it is possible to read and write data using the same port and ip adresse ( connection Id) from to parallel Loops .
i want to open connection to the same Ip adresse and port and at the same time read and write date to my device.
attached below is my VI.
thank you very much for your help in advance 🙂
Solved! Go to Solution.
02-21-2023 11:56 AM
Generally speaking, this is a bad idea. Nothing like A breaking something B needs.
You can mitigate some of this by using a single loop to handle the communications and the other loops can communicate with that loop via a queue (to write) and another queue or notifier to get data back.
02-22-2023 01:38 AM
Hi @Crossrulz,
thank you for your reply. please what do you exactly mean?. i am knew to labview and have already heard about queues but i have never used them. please do you have a link to a quick explanation ?. thanks in advance
02-22-2023 03:24 AM
A server generally handles both, writes and reads. A client is usually the opposite side, so the TCP client.vi and the TCP server.vi wouldn't run on the same PC.
As far as I learned, only servers handle multiple connections at once and devices usually only support one socket connection. The VIs in LabVIEW only open socket connections to remote devices, so they act like clients too. The TCP server enabling that runs in the background as part of LabVIEW or VISA.
02-22-2023 03:31 AM
Hi MaSta,
thanks for your reply.
what i exactly want to do is: i have two Loops (A and B) in my client VI .i want to send data from Loop A to the server and with loop B send data and at the same time read whats the server sends me as reponse to my request.
02-22-2023 03:56 AM
What kind of server are we talking about? In general, you can open multiple TCP/IP connections to the same server. There is an example how to do it within LabVIEW under Networking->TCP & UDP/TCP Multiple Connections (examples\Data Communication\Protocols\TCP\TCP Multiple Connections)
02-22-2023 04:02 AM
Hi cordm,
thans for your reply. what i want to do is write my two clients in the same VI in two Loops that will run at the same time and send datat to the same server.
02-22-2023 04:11 AM
Ok, I see. Misunderstood the goal, because you uploaded a server and a client VI of which for the goal only the client VI would be interesting. I didn't open it, but I suppose that's the one with the two loops.
Ok, so there would be one TCP Open.vi and the handle is then passed to both loops, in one the TCP Read.vi and in the other the TCP Write.vi.
Should work.
02-22-2023 04:15 AM
Please can you explain what you mean? beacause i think that what i did but it doeas not work+
02-22-2023 04:45 AM
You have two TCP Open nodes in your Client VI. The server will only accept one of it. TCP Open should happen before the loop. Right now you are trying to open another connection on every loop iteration but only close the last one.
Either make your server accept multiple connections as in the example or only open one connection in the client and share it with both loops as MaSta said.