06-01-2011 01:02 PM - edited 06-01-2011 01:11 PM
Hello.
My labview version: 8.6.1 dev suite
I'm running into issue with multiple clients/server application whenever I'm using an MS loopback adapter. The point that I'm trying to accomplish is so I can adapt a sync preamble to all my data packets and be able to monitor them through a network protocol analyzer such as Wireshark. I've never had this problem when developing socket app in Java through Netbeans or C++ through Visual Studio but why Labview??
Ok, for those not farmilar with using a loopback, do this:
1. First, install MS Loopback Adapter for XP/2K, and Vista/7.
2. Then set the loopback adapter to a static IP of 1.1.1.1 with netmask of 255.0.0.0 and blank for the rest.
3. Go to the prompt, type "ipconfig /all" get the mac address for the loopback device.
4. Create a batch file, keep this batch file in the startup folder. In this batch file type:
arp -s 1.1.1.1 <MAC-ID> route add 1.1.1.1 1.1.1.1 mask 255.255.255.255
5. Install Wireshark or any equivalent network protocol analyzer.
6. Restart the computer to register the device. Please note step 4 is very important, you won't be able to capture local TCP traffics unless 4 is done.
Now, open LV -> open example -> search "TCP/IP" -> open "Multiple Connections - Server.vi" & open "Multiple Connections - Client 1.vi"
For server side, have the server runs at ip 1.1.1.1. You need to add this into the server listen (lower loop). And notice when you run the client vi (also be sure it's connected to this address as well), look at the server vi. The server opens new socket fine (no error) but the upper bigger loop where the server is passing TCP/traffic back to the client, it just locks up at TCP read. It just locks up, totally locked. Sometimes it returns an error code of 1 which isn't even defined any where in LV document. You can change the read method from standard to the rest too, still locking up with timeout or not, still locking up. Why???????
06-02-2011 05:22 PM
Hi lavalava,
I cannot find "Multiple Connections - Server.vi" or "Multiple Connections - Client 1.vi". Would you mind attaching those?
As for troubleshooting steps, I would recommend running the server on one computer, and the client on the other. If you're able to connect and send/receive data, then we know that the VI's are functioning correctly, and we can narrow it down to something with the routing table.
Also, please post a screenshot of the error message.
Regards,
06-03-2011 04:20 PM
@che T. wrote:
Hi lavalava,
I cannot find "Multiple Connections - Server.vi" or "Multiple Connections - Client 1.vi". Would you mind attaching those?
06-03-2011 04:33 PM - edited 06-03-2011 04:37 PM
Hi, Che. Or you can run my program in the attachment. Just extract them all in the same dir, then execute *runMe.vi" file. My OS is XP x64, LV version 8.6.1. But before you run anything, please be sure you have completed these steps mentioned above:
1. First, install MS Loopback Adapter for XP/2K, and Vista/7.
2. Then set the loopback adapter to a static IP of 1.1.1.1 with netmask of 255.0.0.0 and blank for the rest.
3. Go to the prompt, type "ipconfig /all" get the mac address for the loopback device.
4. Create a batch file, keep this batch file in the startup folder. In this batch file type:
arp -s 1.1.1.1 <MAC-ID> route add 1.1.1.1 1.1.1.1 mask 255.255.255.255
5. Install Wireshark or any equivalent network protocol analyzer.
6. Restart the computer to register the device. Please note step 4 is very important, you won't be able to capture local TCP traffics unless step 4 is done.
Then execute "runMe.vi"
First select localHost and run it, you'll see no problem. Everything works as normal:
Now open up Wireshark as following:
Here you'll see it appears there are TCP transmission errors. Maybe because Labview isn't communication with winsock directly, I don't know ....how you guys built your software.
Now, change it to "MS Loopback Adapter" and run it again. You'll see TCP read is getting stuck, no matter what you do it just stuck everywhere.
Again, as I've mentioned before I've developed multiple socket client/server applications in C+ through Visual Studio & Java through Netbeans and never once have I had this problem. They always work!
And you mentioned I should run the server/client on different computers. No, I cannot do that. I have to communicate with other applications written in non-labview languages through socket on the same computer. This is NOT an option. DLL is not an option either since it's non-existent. Besides, most people are preferring socket over DLL since they're much easier, faster, and painless to deal with.
Thanks.
06-03-2011 05:07 PM
PS. For your primary NIC card, if you are using DHCP IP and you selected localHost, this program might not run because I asumed you're using static IP starting with 192.x.x.x. If you are using DHCP IP, just modify the get IP vi to blank for localHost case. And you should be good to go. Thanks. Sorry about that.
06-06-2011 04:10 PM
Nevermind guys, I think I found the problem. The problem was XP x64. Tried it on XP x86, there were no problem at all but XP 64 bits jacks up the routing table. I haven't tried it on Vista or 7 x64 yet. Shame on Microsoft.
06-07-2011 11:16 AM
Hi lavalava,
Thank you for the update. The client VI was experiencing two errors, Error 54, and Error 1. The Merge Errors function is merging those errors, so we only see the topmost error (Error 1). However, the cause of this error is related to
Error 54, which has the following message
Error 54 occurred at TCP Open Connection in Client.vi Possible reason(s): LabVIEW: The network address is ill-formed. Make sure the address is in a valid format. For TCP/IP, the address can be either a machine name or an IP address in the form xxx.xxx.xxx.xxx. If this error occurs when specifying a machine name, make sure the machine name is valid. Try to ping the machine name. Check that you have a DNS server properly configured.
When I examine the address in the client, it seems that the IP address is in the format "x.x.x.x (Preferred)", when you only want "x.x.x.x". I recommend looking into this issue and trying it again. I created a string constant in your Client.vi pointing to 1.1.1.1 for a quick fix.
Regards,