LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Communication Problem - not passing data???

Hello.

 

I am working on TCP communication. I need to pass data from one PC to another and vise versa. I started with the shipped example TCP Communicator Active and Passive VI. Using the shipped example only with the Wireless Unit connected to both PC i am able to communicate and pass data between each PC.

Now, placing the shipped example VI to my Main VI (separate while loop), I am NOT able to make it run properly. What happens is even if i move the control data on one PC it does not update to the other PC.

I am attaching the example VI and I would appreciate for any advise.

Thank you very much. 

 

regards,

jtc

Download All
0 Kudos
Message 1 of 12
(3,882 Views)

Hi jtc,

      For one thing, in TCP Communicator Active VI, the "String to Write" Read-local is outside the inner while-loop - which appears to be checking its value.  See what happens after you move the local variable "String to write" inside the inner loop.Smiley Wink

 

Cheers!

Message Edited by tbd on 10-11-2008 07:24 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Message 2 of 12
(3,857 Views)

Hi tbd,

 

Thanks for the reply.

 

I manage to find the solution. I can now transfer data from active to passive vi and
vise versa using wireless technology. I reversed the connection of input data on the concatenate string
function which is connected to the shift register. Now its working, but i
have another problem.

As i run both the Active VI on one PC and the Passive VI on another PC, and
at the same time monitor the PC performance in Windows Task Manager, i can
see that it is gradually rising, in a span of 3 minutes,  until it reach
100% which makes it slower to response.

I tried placing a delay (wait until next ms multiple) but the problem still exist.

 

Appreciate for any advise. Thanks a lot.

0 Kudos
Message 3 of 12
(3,812 Views)

Hi jtc,

      "PC performance" might refer to CPU usage or Memory.  Related to Memory, one suspicious thing I see in the VIs previously attached is: the "You Typed" and "Their Response fm Slave" string indicators will grow indefinately at a rate of about 150 bytes/sec.Smiley Surprised  Try constraining these "buffers" to display, say, the most recent 1000 bytes sent or received.  I ran [two copies of] the attached vi for a few minutes and didn't see a problem...

 

Cheers!

 

 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 12
(3,800 Views)

Hi tbd,

 

thanks for your sample VI. indeed the CPU usage memory has been solved.

i did try to use your VI instead. At first i am getting Error 62 and 66. I placed an "Error to Warning" function to eliminate the errors.

But everytime i ran both VI in separate PC, it will suddenly/randomly stops.

The wireless receiver are just sitting in my desk and connected to each PC.

Sometime it will stop soon but sometimes a little longer.

What do you think is the problem?

Thanks a lot.

 

regards,

 

Download All
0 Kudos
Message 5 of 12
(3,776 Views)

Hi jtc,

      I'm not sure what's happening there, though, when I tested this VI it did seem sensitive to click-drag control-changes which result in many rapid "SEND" events and cause error 62 "Serial Port Overrun".  After adding a "Wait Ms" inside the "SEND" case, and waiting about 100ms, this error went away here.

 

Hope it helps!

Cheers. 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 6 of 12
(3,766 Views)

Hello tbd,

 

you have been very helpful.

i realized the timing (ms), data transmission, plays importance on

data capturing. its not only about the tcp but other sensor/s data

that are included in the VI.

 

thanks a lot.

cheers...

0 Kudos
Message 7 of 12
(3,758 Views)

Hi jtc,

      As error 62 seems to reflect a fundamental limitation to performing too-rapid writes, if you need to share data aquiired rapidly, a work-around is to accumulate the acquired data and send larger "bundles" less frequently.  I've used TCP/IP to reliably perform very rapid updates (of many thousand bytes), though, typically use a "closed-loop" approach where after every Write, some ACKnowledhment/response is Read - before next Write.

 

Cheers!Smiley Happy

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 8 of 12
(3,734 Views)

Hi tbd,

 

Thanks for your information. Honestly i am new to TCP/IP. For now I am trying to study one-to-one communication (1-Master, 1-Slave). But later on i have to make 1-Master but multiple-Slaves. No idea yet at this time. In addition i have to consider the data transmission of others that is connected the same controller like RS232 (magnetic Sensor), RS485 (potentiometer sensor), RS485 (digital input/output modules).

"if you need to share data aquiired rapidly, a work-around is to accumulate the acquired data and send larger "bundles" less frequently" - do you have a simple example VI for this?

Again, thanks a lot for your time.

 

Cheers..

0 Kudos
Message 9 of 12
(3,719 Views)

Hi jtc,


"if you need to share data aquiired rapidly, a work-around is to accumulate the acquired data and send larger "bundles" less frequently" - do you have a simple example VI for this?


No! Smiley Wink  - though we could develop something - but a solution for the current example, might not be helpful to your final program.  For instance, we would capture & accumulate a "batch" of data "produced" by individual user actions, then send the "batch" of data to the other machine and what? Perform all the updates to the GUI in rapid succession (what's the point?.)  Show the last user action/setting?

 

It might be a good time to develop the architecture for the Master and Slave applications.

This sounds like an interesting application!  Do you mind sharing some detail?  For instance, are the slaves generating data?  Are there a fixed number of slaves?  Is it necessary to mirror the Master's data on all the connected slaves?

 

Like Johnny-5 said: "Input, I need Input!"Smiley Happy

 

Cheers!

 

Message Edited by tbd on 10-17-2008 08:29 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 10 of 12
(3,712 Views)