LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP connection in a loop

Dear Friends,

I am trying to make my computer with labview to communicate with another computer running VB.net application. I am basically trying to set up a TCP/IP listener. I want the VI to continuously run and send the values based on a command button. While debiggin the VB application in another computer I see that the data is sent only the first time and after that the application does not recieve any data. I am attaching the VI herewith:

Test.VI: It is the main VI

String.VI: Based on the button status I will feed different strings to the TCP connection.

 

I would appreciate if anyone can help me in figuring out why the connection sends data only once.

 

Thanks

Sankar 

Download All
0 Kudos
Message 1 of 4
(3,005 Views)

Hello Sankarnkp,

 

I believe your problem is that you have a breakpoint set on your TCP Write.vi, notice the red box around its perimeter.  Right click on the function and select Breakpoint>>Clear Breakpoint.  It is also good practice to use a shift register to pass your tcp/ip connection ID and your error wires between iterations of your loop.

0 Kudos
Message 2 of 4
(2,990 Views)

Hi

Thanks. The break point was put to see what was going wrong. The problem existed when I ran it without any breakpoint, so I was trying to debug and I forgot to clear it before attaching the VIs. The point on using shift register is well taken. I remember reading it somewhere. I will try and see what happens.

 

Thanks once again!!

 

Sankar

0 Kudos
Message 3 of 4
(2,977 Views)

I would have to say that your problem is probably on the VB side of the equation. I don't see any "smoking gun" in your LabVIEW vi.

Take a look at your TCP read function to see what is going on.

How long are your timeouts set for on the VB side and how long does it take for the VB code to get back to waiting for the TCP Read?

How about your TCP socket connection ID on the VB side. After your read, are you possibly closing the socket or loosing the reference to it?

Does your TCP Read function return any errors? (Timeout, could not create listener, etc...) 

Another possiblity is that your VB TCP function is looking for some form of termination character that it is not finding (CRLF?). The LabVIEW TCP Read function allows this mode of operation but it is not the default, I am not sure about VB. 

 

Based on my experience with TCP, these are the things I would look at first.

 

I have found that the concept of TCP is fairly straight forward, however the proper and reliable management of connections is not quite as easy.

 

As an intermediate step, you could develop both sides of the communication in LabVIEW and stay in that mode until you are confident that you have all of the issues with sequencing, formatting, timing, etc... worked out. Once that is done, convert your TCP reader into VB code.

0 Kudos
Message 4 of 4
(2,956 Views)