LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet Communications Issue

Highlighted

Hello list,

 

I have an ethernet communications issue.

 

We can communicate with our products using two communications modes, ethernet, and a proprietary CAN. For the ethernet connection, I have a router that assigns a DHCP address to the product (169.254.130.005). For the CAN connection there is a hardware ethernet to CAN adapter that has an assigned address of 169.254.130.006.

 

Below is a simplified example of the code I use to talk to the product. (there is only one loop...two loops are shown. One showing the True Cases, one showing the False cases.

 

So I set the I.P. address, set "Connect?" to true, and run my code for a while. I then set "Connect?" to false, change the I.P. address, and then set "Connect?" to true.

 

What I have found is that the "TCP Close Connection" does not actually close the connection, and the "TCP Read" and "TCP Write" are reading and writing to BOTH I.P. addresses simultaneously! (confirmed by using Wireshark). I don't understand how this can be since I only have one TCP Write and one TCP Write, and see only one "Connection I.D." when I probe that wire.

 

Am I not closing the connection properly? Do I have to kill the connection ID in Windows somehow?

 

Any ideas would be appreciated.

 

Thanks in advance,

Mike

 

Using Labview 8.2

Windows XP

 

0 Kudos
Message 1 of 5
(784 Views)

I'm not sure about the "writing to both IP addresses simultaneously" but I can easily believe that you are opening a lot of TCP connections that aren't getting closed. The logic here doesn't make much sense. If Connect is true, you open a new TCP connection on every iteration of the loop, without closing it. When Connect is false, you close only the most recently opened connection (the one that's stored in the shift register). You've lost track of all the other ones that you opened (a bit like a memory leak).

 

You need to rework your logic so that when you connect, you open the connection only once and keep it in the shift register. For example, you could check if the TCP refnum is valid, and only try to connect if it is not.

0 Kudos
Message 2 of 5
(763 Views)

Nathand,

 

The code shown is a simple representation of what I'm doing.  I guess it wasn't clear.  The switch is connected to a shift register to compare the previous & current loops itterations and only opens one connection "on change" of the "Connected?" input.  (that is confirmed with Wireshark).  Also, the product tells me that I have made only one TCP/IP connection on each IP address.

 

I pass the Connecion ID that is created out the right side of the loop and into the left with a shift register when the connectionis made...so the same Connection ID is used for each read/write.  What I'm not understanding is how I can see only one Connection ID on the wire but a read/write to both I.P. addresses with only one one read and one write in my code.

 

Any other ideas would be appreciated.

 

Thanks,

Mike

 

 

0 Kudos
Message 3 of 5
(749 Views)

Please post your actual code. It doesn't help to post code that has obvious problems, then note afterward that the code isn't the real code.

0 Kudos
Message 4 of 5
(745 Views)

Nathand,

 

Sorry, I can't post the actual code here because it's propriatary. (not my choice, trust me)

 

I've also opened a help ticket with NI about this issue.  We have a NDA with them so I can send my code to them if need be.  I'll post a solution once I figure it out (or someone else does), but this one has got me stumped.

 

Thanks for your help,

Mike 

0 Kudos
Message 5 of 5
(739 Views)