LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP connection

Hi,

     Iam learning the basic TCP connection.Took an example shipped with Labview.Some changes are made as shown in the attached VI.We have another computer system with the same VI.And we are trying to communicate with the two systems.we entered the IP address of the opposite system.And the connection is established properly.When we change the function to sinewave,chirp etc:- that change can be visible in the waveform graph of the other system.But the problem is when we are trying to achieve a full-duplex communication,it is not possible.The VI that we run first can only act as the server.Please give me possible suggestions.  

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 1 of 11
(3,380 Views)

Hi danil,

 

have you tried not to use the same port for sending and receiving data?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,379 Views)

OK.Thanks.That was the problem.

I opened the Simple Data Client.vi and Simple Data Server.vi(shipped LV2011 examples) in both the systems and started running both.That time without changing the send and receive port it is working.Can you tell me how it can be?

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 3 of 11
(3,368 Views)

Hi GerdW,

                 There is one more thing to ask.In the attached VI while running the VI in one system and the VI in the other system is not running,it is showing Error63            "The network connection was refused by the server."How can this be avoided?

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 4 of 11
(3,354 Views)

TCPIP is full duplex, and you could use the same port to read or write data. The example shows only one way connections, where the client vi connects to the server and gets the data.

Two machines establish a TCP connection by creating or using connection end-points that are called sockets or ports. Each machine can have up to 65535 (2^16-1) open ports. So it is possible to have many connections between two machines. One port can be involved in many connections (with different ports on the the other host, or with the same port on different hosts).

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
Message 5 of 11
(3,348 Views)

For your application, the process is simple. Put wait on connection function on the server side. When the connection is established from client side, take the data, flatten it to string, then take the string length and do a tcp write, and then the data write using the same function. On other side, do read two times, one for data length and other for the actual data. Unflatten it to the data type used in the server.

 

 

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 6 of 11
(3,347 Views)

Hi,


I am also facing the same issue.
I am running a server using TCP/IP connection on a specific port(Ref: Simple Data Server shipped with LabVIEW 2011)
I have received the signal sent from the Server using a client. I need to get alerted on server when a client connects to it.
When TCP/IP connection established with a client, The server should identify it.


Thanks

0 Kudos
Message 7 of 11
(3,315 Views)

Here is a contrived example I put together once to show bi-directional communication between a client and a server.



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 11
(3,283 Views)
Hi, Please point out the problems with this simple connection.It won't returning the bytes written.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 9 of 11
(3,241 Views)
sorry can't able to attach the file.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
0 Kudos
Message 10 of 11
(3,240 Views)