TCP/IP instabilities in LabVIEW?

I'm just beginning to work with TCP/IP in LabVIEW and I'm hitting some problems. As usual the hardest part is knowing what questions to ask.
Background: Essentially, we have a PC (Windows 7) running LabVIEW (2011), communicating with a Staubli CS8 robot controller. The code on the controller is written using Staubli's native VAL3 development environment. It's set up so that we send it pre-defined command strings via TCP/IP. The robot performs the command and when it reaches its destination it sends a response string.
If I use Putty to send the strings via command line, everything works fine, and I get the response string expected loud and clear afte the robot has performed its task. If I use LabVIEW, however, using code based on the TCP 'active' and 'passive' example functions, I get communication most of the time, but occasionally the system hangs.
The robot almost always get the movement command - this is obvious as it starts moving. The problem seems to be more to do with the fact that the 'listening' portion of the LabVIEW code seems to be occasionally missing the string sent back to the PC, and the listen loop then runs indefinitely, thereby causing the system to hang.
Using timeouts as a quick fix is out as the robot speed can be varied, therefore there is no way to know exactly when the robot is going to send back its message to the PC (although it's always going to be on the order of seconds).
So my initial questions are:
1.) Is a degree of instability normal in communications using TCP/IP?
2.) Why does LabVIEW appear to be less stable than Putty?
3.) Does anybody have TCP example VIs that I can contrast with the two examples that ship with LabVIEW?

I can only support Julianne's statements. I have done quite a few intensive network communication libraries and projects and don't see instabilities as you describe them, if the LabVIEW part is programmed correctly. Network communication I have done include both TCP/IP and UDP based protocols and also binary and ASCII style variants of those.
Network programming is different than other LabVIEW programming in several ways. You have to be prepared that network functions can return errors for many reasons, and that some of them should be ignored, some of them indicate to retry the operation, and some require you to close and reopen the connection. Which error means what, is the biggest part of the magic about network programming and there are no definitive rules about this, as it can depend on the used protocol, the particular implementation of the remote side and sometimes other factors you need to figure out.
With some experience you learn to program fault tolerant network communication, that can work with different implementation specific behaviour of the remote side but this stage can sometimes feel a bit like magic and the only way to get it to work right is usually by trial and error, and some logical thinking about what the different network layers are supposed to do.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • Tcp data b/w labview and c++

    Hi
     i am trying to establish TCP connection b/w LABVIEW and C++ program. Server is established in C++ while client is implemented in labview.Although connection is successfully establish b/w server and client, both are unable to correctly understand data send/receive among them. Forexample if i want to send an int type send_array from server, i use standard WINSOCK function "send" like that:
    send(AcceptSocket,(char*)send_array,129*4,0);
    but when client in labview receive this array, it shows unexpected values.As a client, I used "simple data client.vi"  with one modification i.e. as sent data size(129*4 bytes) was fixed, only one TCP read was used . 
    Same problem exists if i send data from client to server.
    Kindly help me
    Best Regards
    Solved!
    Go to Solution.

    It's probably an big/little edian problem. If you are using the Flatten/Unflatten from String functions, you can specify which to use.

  • TCP/IP communication between labview and microchip board

    Hi
    I have a microchip board which sends out data over the Ethernet. I have to read this data and use for further mathematical computations on it. So I decided to use some available examples on Labview. I find that all examples come as a pair, client-server. But in my case the board will be the server ( providing data continuously) and Computer with Labview will act as a client (Continuous receiving). Is there any readily available example on Labview for this purpose. If not, can you please suggest which example I need to modify for my purpose? Thanks
    Arvind

    arvind3tthiru wrote:
    Hi Greg, thanks for the reply. I am connecting to a PICDEM.NET2 board which is sending data through its ethernet port. I know the port number and the IP address of the board. I want labview to listen to this port and store the incoming packets. I am not sure how LABVIEW disintegrates the TCP packets and takes only the data out. Since I am not seeing anything on the LABVIEW client, so I am starting to think that TCP Client on LABVIEW may have some prescribed packet format which is not the format in which I am sending my data in. Please enlighten me if I am wrong. If you need more information, please tell me what you will need, I will provide you immediately.
    Thanks
    Arvind
    LabVIEW has no "predesribed" packet format, and it doesn't take packets apart. LabVIEW operates at the application level, so the OS is responsible for providing the data that's contained in the packet to LabVIEW. LabVIEW just sees the data in the packets.
    Have you verified that a connection is actually being made? You said that the LabVIEW should listen to this port. Did you create a listener on the LabVIEW side? Does the microchip code indicate a connection? You may want to use Wireshark to capture the packets to see exactly what is going on.

  • Tcp/ip communication with LabVIEW

    Does anyone have experience building an application with LabVIEW that
    communicates over a socket? I new to LV, but it appears that the
    application I have in mind is possible. Specifically, the LV
    application would open a socket (port and IP known ahead of time) and
    send a character to that socket. Depending on the character sent, the
    application on the other end (a UNIX process) would send back a one
    integer value to indicate the number of packets to expect. The LV
    application would next need to parse each packet for such things as the
    packet length, data length and so forth and then distribute those data
    to appropriate sub-processes. The header value types are integer,
    double, byte and character. The data values are all 4-
    byte integers.
    The sending code (on the UNIX side) was written in C. The aggregate
    throughput is relatively low; no more than 2,000 bytes per second,
    including packet headers.
    If I can get this to work, the results would represent a significant
    cost savings over competing alternatives. As a federal employee, I'm
    always looking for the most cost effective solutions.
    Thanks.
    -Robert
    Basically, I'm just looking for confirmation that this sort of thing is
    possible with LV. And, I'd like to get a better idea of how hard it
    would be to do.
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

    Hi everyone,i am currently trying to communicate with two computers at the moment using TCP/IP.I have done a simple server and client VI but the server doesnt seem to be writing the string im trying to send and it also gives an error message
    Error 1 occurred at TCP Write in Server.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
    Please find attached the simple server and client VIs i have done.can you help me?
    Thanks
    Osowoaji
    Attachments:
    Server.vi ‏13 KB
    Client.vi ‏13 KB

  • TCP/IP coupled Hardware (@ Labview)

    how is the way to develop external Hardware (with proprietary TCP/IP coupled Hardware) in Labview.

    The tcp/ip functions come with LabVIEW and you don't require additional drivers. If you wish to use VISA for communication like instruments from Agilent, Keithley, etc., then you need to install NI-VISA. Look at any driver that supports Ethernet for an example.

  • TCP/IP communication with LabVIEW Full?

    Hi,
    I would like to know if the TCP/IP VIs are included with the Base or Full version of LabVIEW?
    I was looking at the different versions of LV and one of the features of the Pro version is 'Network Communication'.
    I have done TCP/IP communication a while ago and I am quite sure it was with the Full version. I have the Pro version now but this is for a customer.
    This brings another question: Is there a trick to be sure your code is going to work on a system with LV Base if you develop on a system with LV Pro?
    Thanks!

    I think that was a good answer to your first question. To answer your second question, if you are creating executables to be run on a computer with LabVIEW Base there will be no problem running the executable because LabVIEW Base has the run time engine. If you are sending VIs to another computer with LabVIEW Base they will not be able to access any VIs that are not included in there package. There is no simple way to tell that these VIs are not included except through the link in the previous post. In LabVIEW 8.6 many of the help documents state what LabVIEW package installs the VI. If all of the VIs state that they are installed with LabVIEW Base you will have no problems.
    Vince M
    Applications Engineer

  • How can i use the SNMP and TCP/IP together in Labview?

    I want to use the SNMP and TCP/IP together in the Labview to communicate between the two computers, If anyone know about it , please write back.
    Santosh Chavan
    IIT MADRAS.

    You can use LabVIEWs UDP functions to communicate with SNMP devices. The tedious part is converting the MIB information into the required hex message.
    There is also a problem in using the UDP functions on port 161 (default SNMP port) if the Windows SNMP services is running.

  • Capture video through TCP/IP protocol in labview

    Hi Friends, How to acquire video data using TCP/IP read? actually i am trying to control a robot using labview. This robot has WiFi card and has an ip 169.254.0.10. Robot control protocols are already burnt into blackfin processor, of the robot, example.... if i enter 8 in string control of front panel, robot will move forward, 2 is backward, 6 is right and 4 is left. Robot has camera and transmits images through tcp/ip protocols. well.... i am able to establish wifi connection between my PC nd robot and i am able to control it simply by entering corresponding numbers in string control of VI but i am not able to acquire video from the camera through TCP/IP read platelet. ( someone has created a java consol for this robot and i downloaded it from online forum. by running this consol i can control the robot and also accquire real time video) but i want to do the same using labview. please help.
    labview version: 8.6
    NI vision 8.6
    vision acquisition 2009
    robot reference
    robot control protocols: http://www.surveyor.com/SRV_protocol.html
    http://www.surveyor.com/SRV_info.html
    journal: http://www.surveyor.com/cgi-bin/robot_journal.cgi
    Forum: http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl
    Attachments:
    roboimage.vi ‏39 KB

    You do realize that you are not actually reading any data, don't you? Your input to the TCP Read VI is the default which is a value of 0. So in essence you are saying read nothing. Also from reading through some of the information you pasted it appears that the video is streamed via a web browser. There simply reading from a TCP port will not accomplish what you want. Do you have the Interent Toolkit? That has an HTTP protocol implementation which may work for you though I don't think it will have what you want. It looks like you need to send an HTTP GET to retrieve the video image. You could also try using ActiveX or .Net to embed a browser window in your application.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • TCP Open Briefly hangs LabVIEW

    Hello LabVIEW forum! Long time no see. I have been away from LabVIEW doing other things but.... I'm back.
    Background:
    I am working on a project where I need to make a TCP connection to a Windows 7 machine. The Windows machine will intentionally reboot for each test. When it boots i need to make a TCP connection to a server that automatically starts on the Windows machine and send some commands. While it is booting, I try to connect, get an error, try again, etc until the connection is made.
    The problem:
    This machine name is not resolved by DNS or the hosts file. If I try to connect using a host name, and the host name cannot be resolved, LabVIEW will freeze for a few seconds. If I click the red abort button I get the not responding error. It will eventually recover and give me an error 54. The timeout is not relevant in this situation. It doesn't matter how long or how short I set it to, it always hangs LabVIEW for about three to five seconds. If I try to connect by IP number instead, then I don't see this problem. If the machine is off I just get a timeout error but LabVIEW doesn't freeze.
    I cannot post code but try this: Write a VI with an infinite while loop and an indicator connected to the i terminal and place a 100mS delay in it. Run that and notice that the number increments. Now create and run a second VI with the TCP open in it and use a machine name that does not exist. What I see is that the number in the first VI will quit incrementing. I am using LabVIEW 2014 32 bit on Windows 7 Ultimate 64 bit. First open a console and try to ping the non-existant name you are trying to connect to and verify that it doesn't print an ip number. Some Internet providers will resolve all non existant hostnames to an IP they own for their own gain. If that is the case then you will not be able to duplicate this bug.
    I have a workaround (put an entry in my hosts file) but I thought I would mention this possible bug. Plus it gives me an opportunity to say hi to all my old friends on my favorite fourm! (the list is long but you know who you are)
    =====================
    LabVIEW 2012
    Solved!
    Go to Solution.

    LabVIEW calls Winsock for all network operations. Most of the Winsock operations are synchronous. This is not a big problem for most of LabVIEW code as LabVIEW is multithreading and executes the nodes in whatever thread the current VI is at. However some functions need to access some global data space and are protected by some means. This can be a global mutex and sometimes it's also solved by forcing the node to always execute in the UI thread of LabVIEW which also executes the windows message loop and Winsock does hook into that message loop to do its own internal pseudo synchronous operation.
    The check for Adres to IP is something you can try. It may also lock up because of the internal Winsock hooking into the application message loop, but maybe it won't so that you can circumvent the problem. There is no way for an applciation using the normal Winsock API to avoid internal Winsock timeouts for synchronous functions, and the adress resolutino API does not really support asynchonous variants.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Wifi video capture using TCP/IP protocol in LabView

    i have designed a robot with a camera and i am trying to control it using LabView. I am using TCP/IP communication protocol (My robot has wifi card for communication, IP: 169.254.0.20)... i am able to control the motor and make my robot moves in any specified direction but i am not able to acquire video from the camera. i have installed NI vision drivers but still i am not able to aquire video. is there any IMAQ wifi driver available. if not, is there any other logic to aquire continious video from a camera using tcp/ip?
    i am using LabView 8.6
    wifi: private IP 169.254.0.20
    Attachments:
    robo.vi ‏9 KB

    Without knowing the specifics of the camera you are working with it is impossible to give you advice on what your code needs to do. For instance, to obtain an image do you connect to the camera or does the camera expect to connect to a server? If you connect to the camera is there a specific protocol you need to use to request the image? Generally in networking there is some application layer protocol required for two devices to communicate with each other.
    I don't have much expereince with IMAQ itself to answer your question as to whether there are VIs that already do this or not.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Changing local TCP/IP settings via labview

    Is there any means of changing the TCP/IP Settings on the local PC programaticaly. This may involve reseting the NIC instead of reseting the PC

    In win2K and higher, you can use the solution I posted here.

  • Computer locks up transferring TCP/IP data to labview vi

    Hello,
    I am transferring data to a Labview v7.1 vi and the computer locks up after several minutes data transfer. The amount of data transferred is continuous for this time period. Are there suggestions for dealing with this issue?
    Thanks,
    Ron

    Hello,
    When you say your computer locks, does that mean just your VI or all applications?
    It's possible that LabVIEW is consuming much of the CPU, especially if it's the only application running, and you don't have any timing/wait functions in a loop.  In such a case you can imagine that code is executing as fast as possible, and if nothing else is running on the machine, it can appear as though things lock up.
    Try using the wait until next ms multiple or wait ms function.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • Arduino Yun tcp/ip with Labview

    Hi. Are you able to use labview to control an arduino yun using tcp/ip wirelessly?(For example turning on and off a relay) Has anyone done it before?

    OK, so you'll need to write two bits of software - your Arduino Sketch and the LabVIEW code. You'll need to think about which piece of software will be your 'server' (listens for a connection on a specific port) and which one will be your 'client' (establishes the connection). Once you've established the connection, either the server or client can send/receive data at any time. 
    You will also need to define a communications protocol - this is the series of commands you send/receive to make things happen. For simplicity, I'd recommend a simple ASCII string protocol (for example: RELAY ON). You'll also need to determine the termination of the TCP/IP commands - this is commonly done using the CRLF character sequence or by prepending the TCP packet length to the data before sending and when you receive you read the 'length' bytes first and then the data.
    For the Arduino side - I'm sure you'll find lots of example sketches of how to do TCP/IP communications.
    For the LabVIEW side - look in the LabVIEW examples and you'll find a simple client/server example which shows LabVIEW acting as both a TCP server and TCP client.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How to read data over tcp/ip using labview

    Hi,
    I have a network enabled force transducer (6-axis load cell). I know its IP addr. and the data format it is sending the data out (7 32-bit DWORD, One status and 6 axis force data) . I have been playing around with the simple data client.vi example program. 
    When I executed the program using the devices IP addr. I used to get error 63: TCP/IP connection open. Then I ran the program using localhost in IP addr field, the program executes now indefinetly at one block only. I am attaching the screenshot for ref. 
    Thanks.
    Sasi.
    Attachments:
    TCP-IP.JPG ‏62 KB

    Hello,
    I'm wondering if you can create a rather simple VI that just tries to open and close a TCP connecting to your transducer. All you would need is a TCP Open and a TCP Close wired together with the proper IP address etc. Does this run? I did look to see if there was any NetFT information and I could not find anything. I feel that the problem lies in the communication protocol between your transducer. Another place to see if you can connect to it would be to try hyperterminal. You can access this in Windows XP by clicking Start»All Programs»Accessories»Communications»HypeTermina. Using this, you can try and connect to your instrument with TCP/IP outside of LabVIEW. You might also want to get in contact with the manufacturer to verify that third-party software can indeed communicate with it. There may be a specific set of instructions that need to be sent to the transducer in order to initiate the connection and then read from it. These may be in the form of serial commands that would need to be sent over TCP. What is the make and model of your transducer?
    -Zach
    Certified LabVIEW Developer

  • How best to receive large short array --- tcp, socket, LabVIEW, ShortBuffer

    The application in question works with a LabVIEW program via Ethernet (a tcp connection). The LabVIEW program generates a large (e.g. 600x600) array of numbers (either 32-bit floats or 16-bit signed ints, whichever we choose). The question is what is the fastest, reliable, way to get those numbers? LabVIEW can send it two ways, the first is to convert the array to a string, the second is just to send the array data as-is. I believe that converting to string inflates the size of the message so much that this is not a good option. So I guess my question is how to receive the array of numbers (either as 32-bit floats or 16-bit signed ints)?
    I was thinking of using a FloatBuffer or a ShortBuffer. The latter would be best since floats do not get us any extra information in this case, so I do not know why I even bothered to consider using them. I guess what happened was that I learned first of the existence of the FloatBuffer, so I sought to get LabVIEW to send floats. Now that I know there is a ShortBuffer I guess floats are out. Okay, rambling, do you think a LabVIEW array of shorts will be able to get read by a ShortBuffer on the other end of a TCP connection? Also, am I going to have to call read() multiple times in order to get all the elements of the array?

    theHandOfTheKing wrote:
    The application in question works with a LabVIEW program via Ethernet (a tcp connection). The LabVIEW program generates a large (e.g. 600x600) array of numbers (either 32-bit floats or 16-bit signed ints, whichever we choose). The question is what is the fastest, reliable, way to get those numbers? LabVIEW can send it two ways, the first is to convert the array to a string, the second is just to send the array data as-is. Text is more likely to be reliable as you will be able to read the data to see when something has gone wrong and have a better idea of why.
    I believe that converting to string inflates the size of the message so much that this is not a good option. Why do you believe this? Do you have a bandwidth or time limit you haven't mentioned?
    So I guess my question is how to receive the array of numbers (either as 32-bit floats or 16-bit signed ints)?You can optimise the data send later after you get something working.
    I was thinking of using a FloatBuffer or a ShortBuffer. The latter would be best since floats do not get us any extra information in this case, so I do not know why I even bothered to consider using them. Not sure why float would have less information.
    Okay, rambling, do you think a LabVIEW array of shorts will be able to get read by a ShortBuffer on the other end of a TCP connection? Provided the data is only shorts, its ideal.
    Also, am I going to have to call read() multiple times in order to get all the elements of the array?yes.

Maybe you are looking for

  • Problems deploying a Web Service to Tomcat 5.5

    I am creating a J2EE 1.4 WebService using JDeveloper 10.1.3. Everything works fine while testing in the embedded OC4J server. When deploy the WAR file to Tomcat 5.5 everything goes haywire. I get the following error message: =========================

  • Itunes 10.6 error 7 after installing

    I have just recently tried to update itunes to 10.6 using Windows 7 32-bit. As soon as I turn on Laptop it comes up with itunes.exe error with a SQLite.dll error. once I click the ok it says Itunes was not installed properly with Error 7 (windows err

  • HP x2301 monitor: flickering on gray color

    I bought x2301 about 4 months ago and since day one, it flickers whenever there's a chunk of light grey color displayed on screen. It gets even more obvious when I go from grey background to white background. It's connected via DVI to NVIDIA GeForce

  • Captivate 8 drag and drop interaction not working

    Hi, I am working with Captivate 8 and created a drag and drop interaction using the drag and drop wizard. For some reason when I preview the interaction some of my drag sources work and others do not. I have searched high and low for what I may be do

  • How to download webdynpro Component in ABAP

    Hi, Can anybody tell How to download Webdynpro component to desktop? is there any Function Module to do so?