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

Similar Messages

  • 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

  • TCP/IP communication with remote host

    Hey guys,I wrote a class for TCP/IP communication with remote host.I am trying to use this class in following way:Its not working.One thing I am not sure about if I can give IP address of the machine while creating a socket.Please take a look at my program and let me know where i am doing wrong.Help me!
    CommunicationAgent commAgent;
    commAgent= new TCPIPCommAgent();
    writer = commAgent.getWriter("CASS");
    /* Send GC request message to CASS */
    writer.print(searchduedateRequestMsg);
    /* Get reader object to read TCP IP response from CASS */
    reader = commAgent.getReader("CASS");
    /* Read response message */
    String respMsg = reader.readLine();
    if(respMsg!=null)
    System.out.println("Search due date Response from CASS is:" +respMsg);
    else
    System.out.println("Error in reading search due date response");
    and here is my class responsible for TCP/IP communication:
    * Created on Jul 15, 2004
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package com.prtc.commif.framework;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.net.Socket;
    import java.net.UnknownHostException;
    import java.util.Properties;
    import com.prtc.commif.framework.interfaces.CommunicationAgent;
    import com.prtc.commif.util.InputResources;
    * @author spolireddy
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    public class TCPIPCommAgent implements CommunicationAgent
    public BufferedReader getReader(String system)
    InputResources inputResources = new InputResources();
    Properties props=inputResources.getProperties(system + ".properties");
    Socket socket=null;
    BufferedReader in=null;
    //Get this from the properties
    String hostName = "113.132.192.21";
    //Get this from the properties
    int port = 10103;
    try
    socket = new Socket(hostName, port);
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    catch (UnknownHostException e)
    System.err.println("Unable to identify the Host: " + hostName + ":" + port);
    System.exit(1);
    catch (IOException e)
    System.err.println("Couldn't get I/O for the connection to: "     + hostName + ":" + port);
    System.exit(1);
    return in;
    public PrintStream getWriter(String system)
    InputResources inputResources = new InputResources();
    Properties props=inputResources.getProperties(system + ".properties");
    Socket socket=null;
    PrintStream out=null;
    //Get this from the properties file
    String hostName = "113.132.192.21";
    //Get this from the properties file
    int port = 10103;
    try
    socket = new Socket(hostName, port);
    out = new PrintStream(socket.getOutputStream(), true);
    catch (UnknownHostException e)
    System.err.println("Unable to identify the Host: " + hostName + ":" + port);
    System.exit(1);
    catch (IOException e)
    System.err.println("Couldn't get I/O for the connection to: "     + hostName + ":" + port);
    System.exit(1);
    return out;

    Hi,
    Yes, you can specify ip-address as host-address.
    What do you expect the class to do? Why does reader and writer both open sockets?
    What happens when you run the program?
    /Kaj

  • OBD1 ALDL communication with Labview VISA

    Hello all,
    I am new to serial communication with labview.
    Task:
    trying to send a command and receive data from a 1987 corvettes ECM using VISA serial block in labview.... and failing hard
    Troubleshooting the problem:
    Hardware: works with EFI live V4 (software that communicates with cars), send and receives data all day long, so my hardware is not the problem
    software: it is something i am doing wrong in my coding
    Example code form EFI live V4:
    37:30.137: Send: $80,$57,$01,$00,$28
    37:30.137: Finished writing frame
    37:30.137: Wait 10 ms after writing, before reading...
    37:30.147: Start reading frame
    37:30.147: Aldl frame header byte: $80
    37:30.147: Aldl frame length byte: $57
    37:30.147: Recv: $80,$57,$01,$00,$28
    37:30.147: Finished reading frame
    37:30.147: MAX232 echo: $80,$57,$01,$00,$28
    37:30.147: Wait 10 ms after writing, before reading...
    37:30.157: Start reading frame
    37:30.160: Aldl frame header byte: $80
    37:30.160: Aldl frame length byte: $95
    37:30.241: Recv: $80,$95,$01,$1E,$5B,$00,$00,$00,$00,$00,$44,$44,$1D,$00,$9C,$D6,$00,$00,$FF,$66,$00,$80,$80,$00,$80,$64,$80,$FF,$00,$80,$00,$27,$27,$00,$00,$00,$77,$00,$3A,$00,$43,$00,$00,$00,$00,$00,$00,$00,$00,$01,$BD,$00,$00,$00,$00,$00,$00,$D5,$2A,$22,$00,$07,$00,$00,$0C,$00,$DE
    37:30.241: Finished reading frame
    Example code protocol i tryed into the visa block in labview:
    $80,$57,$01,$00,$28
    $80,$57,$01,$00,$28\n
    $80,$57,$01,$00,$28\r\n
    $80$57$01$00$28
    $80$57$01$00$28\n
    $80$57$01$00$28\r\n
    80 57 01 00 28
    80 57 01 00 28\n
    80 57 01 00 28\r\n
    8057010028
    8057010028\n
    8057010028\r\n
    VISA read Result:
    i just get an eco back of the same command i sent
    Question:
    is there something simple i am missing in the command protocol or a possible setting i am overlooking?
    also what is the purpose of the “$” in the Hex command?   
    background info:
    vehicle : 1987 corvette
    ECM type: 16198259
    com. protocol : ALDL OBD1
    labview v8.5
    baud rate: 8192
    data: 8 bit
    parity: none
    stop: 1
    buffer size: 256

    Are you actually supposed to be sending hex? You need details on the actual format of the data. I don't think viewing the output of some other program will tell you what is truly being sent and received unless its a sniffer such as portmon.
    You can right click on the string control and select hex display. You also did not include the actual VI so no one knows if you have it set to send \r and \n correctly.

  • 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.

  • Fast low level Ethernet communication with LabVIEW

    Hello, I want to read Ethernet packets with LabVIEW (an private protocol, not UDP or TCP or others). The hardware writes 40 000 packets per second. I want to use winPcap API to capture data. I’ve seen the example «packet_sniffer_project » (and others). It’s an great job. But the soft reads only 1 packet at each time (wrapper dll calls « pcap_next_ex » function) and I lose packets. With my computer, I read 25 000 packets per second. How can I read more than one packet at each time? (or all the Ethernet buffer) Thank You
    Micke

    Hi,
    maybe an example that I posted will help you
    http://decibel.ni.com/content/docs/DOC-11373
    cosmin 

  • Adapter for TCP/IP communication with XI

    Hi Experts,
    The provider of the external system sez he will use TCP/IP communication...
    wat adapter do we have to use in XI?? pls help

    TCP/IP  is a connection oriented network protocol. TCP - Transmission control protocol   IP - internet protocol.
    TCP/IP is a 7 layers model  and the top layer is a application layer where all the applications or services are supported such as file, HTTP, Webservice etc....   PI adapters are application layer services. SO PI can support all the current adapters.
    >>wat adapter do we have to use in XI?? pls help
    Since TCP/IP establishes connectivity between one system to another system using network protocol, PI can use that connection for communication.  You can use any adapter that PI supports. please elaborate your question.
    Link: http://www.tcpipguide.com/free/t_ApplicationLayerLayer7.htm

  • How to use a namespace in a C++ code communicated with labview

    I have a long code written in c++.  Now I want to acquire data with labview, send some data points as an entry to my c++ code and it will return a value to Labview.  I tried with a simple sum of two elements and it worked, but in my long code I have so use some namespaces and subfunctions.  If I try to compile it does not accept a namespace such as std.
    Can anybody help me?

    I'm not certain the difference (and there isn't an attachment). However, if the functions you are exposing from your DLL are not marked as extern "C", then you'll have a lot of difficulty calling it from LabVIEW. You don't want to deal with the C++ name mangling, so keep the API simple and straight C. Behind the function signature, however, you can use whatever you want.
    If you are already doing this, can you answer the following
    1. What, exactly, is going wrong?
    2. What version of LV?
    3. What version and platform is the C++ compiler?
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • What programming resources exist for doing direct TCP/IP communication with the FP-1600 ethernet interface?

    I am no stranger to IP communications (UDP or TCP), and I am attempting to build a project controlled by a Linux system. The FieldPoint 1600 looks interesting, but I can find no programming manual describing it's use.. only a dumbed-down 'user manual' describing how to use Windoze software. Is there any hard documentation on this device, or should I look elsewhere for my solution?

    Nathaniel,
    The FP-1600's use a National Instruments proprietary communications protocol. At this point in time, there are no plans to release the protocol. On the other hand, the protocol for the FP-1000/1001 serial network modules is published in the FP-1000/1001 Programmers Reference Manual and can be implemented on any platform.
    If you are using LabVIEW, I have recently created a driver for the serial modules, that is multi-platform, that will be included in the next version of FieldPoint Explorer, but I will also be making it available for download independantly of FieldPoint Explorer.
    Regards,
    Aaron

  • Reading data from mlx90129 rfid tag chip by using spi communication with labview?

    Hi,
     i have evb90129 evalution board in that mlx90129 chip and external memory (cat25128) and three external sensors are there, i am logging data from chip by using rfid reader it ok i am reading. at the same time i configured spi communication and  i am trying to read data i am reading data from internal memory not from external memory i tried but i didnt suceed , now can i use labview to read data from mlx chip and external memory. for spi communication i am using sparkfunction atmega168 microcontroller and also i have spi to usb cable? now can i communicate or i required any devies? is it possible?
    thanks in advance,
    biji.

    I suspect the culprit to be the first parameter to your function actually. Calling another function requires the caller to allocate any buffer with a big enough size for the function to write something into. Allocate that array by using Initialize Array with U8 as type and the correct number as size. Pass this size also as read_length. While your code doesn't make use of this I think the third parameter to your function is either wrong or unnecessary.
    As you use it now it is really nothing more than a local stack variable which you could declare inside the fucntion just as well. On the other hand what you probably want to do is have a function prototype like:
    extern "C" _declspec(dllexport) unsigned char read_Sensor(unsigned *char read_data, unsigned long read_length, unsigned long *byte_transfered);
    But you will have to do some modifications in your C code to support that parameter correctly.
    That all said, doing the same in LabVIEW using VISA functions would have been done with about two VISA nodes, no DLL headaches and probably already long ago working.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • TCP/IP communication with Matlab

    Since LabVIEW unwisely depends on Microsoft only constructs to communicate with Matlab, has anybody succeeded in piping commands/data from a LabVIEW session running on a Mac / Linux to a Matlab session running on the same machine ? Use of MathScript is not an option since MathScript does not have all the toolboxes and more critically, does not offer a programmatic way of saving plots (the print command).

    Yes, Microsoft has provided COM tools for the MAC OS. This article provides a brief overview.
    Also, LabVIEW has a number of tools for configuring and programmtically printing and saving plots. I do not believe it appropriate to discuss notions of platform superiority. I simply would like you and future forum readers to be aware of the tools available in LabVIEW for plotting tasks:
    Customizing Graphs and Charts
    http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/customizing_graphs_and_charts/
    In addition, there are a number of image tools available:
    NI LabVIEW Modules and Toolkits for Image and Signal Processing
    http://www.ni.com/labview/family/image_signal_processing.htm
    Cheers, 
    Patrick Corcoran
    Application Engineering Specialist | Control
    National Instruments

  • TCP client communicating with UDP server

    Hello,
    I want to make a TCP client to communicate with an UDP server. Does anyone know a way of doing this? I am not interested in reliable data transfer. So I don't care if the datagram is lost. I want to make the UDP server accept some datagrams from the TCP client. Also, the datagram that I want to transmit is less than 65,536 octets so it is not devided to several datagrams. Therefore, only one exchange procedure occurs.
    I made an UDP server using DatagramSocket and DatagramPacket classes and a TCP client using Socket class, but the TCP client informs me that the connection was refused.
    Any ideas?

    Let's google for IP header and the first hit is http://www.networksorcery.com/enp/protocol/ip.htm (Whoa! Classic page! I must have seen that back when googling was called altavista.)
    There is a header field, a single byte, called protocol. For TCP/IP that field contains 6, for UDP/IP it contains 17.
    If you send a packet with protocol=17, the receiving host's kernel will check if it has an process listening to UDP (17) at the port specified in the packet header. No such process? Then simply discard the packet. So you can't send an UDP packet to a TCP socket because the protocol field is wrong.
    If you want to fake a TCP stream you could look into jpcap, which allows you to capture and send raw packets. Google for it; and pick the right jpcap, there are two, only one of which (AFAIK) can send packets. Attempting to write your own TCP implementation is highly advanced though, and not really practical.

  • Lifelines trackit EEG recording with LabVIEW

    Hi, I am trying to control a lifelines trackit EEG (www.llines.com) recorder using LabVIEW via serial communication (DB9). Does anyone has any experiences connecting this device with labview? I've done several communication via serial communication with labview before but not as tough and difficult as the current task. I am not able to understand the device (trackit) command in order for me to apply the Basic Serial Read and Write VI. Please advice. I have the Lifelines trackit recorder Interface specification in softcopy as reference but do not know how to attach here. Please let me know if you guys need the  copy as reference. TQVM
    Host Transmit Write Data and Write Command
    [SOP] <AddrHi> <AddrLo> [Chr(W)] <ParamBlock> <Index> [EOP]
    Or:
    [SOP] <AddrHi> <AddrLo> [Chr(W)] <ParamBlock> <Index> [Data]# [EOP]
    Or:
    [SOP] <AddrHi> <AddrLo> [Chr(W)] <ParamBlock> <Index> <Data># [EOP]
    Or:
    [SOP] <AddrHi> <AddrLo> [Chr(W)] <ParamBlock> <Index> {Data}# [EOP]

    Is there a demo program from the manufacturer that works?? you can use portmon or NI spy to capture the serial datastream and reverse engineer the labview code. Sometimes ya have to think like a hacker.
    http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx
    http://www.ni.com/support/gpib/max/nispy.htm
    Message Edited by unclebump on 02-16-2009 08:34 PM

  • USB Communication with Cygnal Kit C8051F320-TB

    Hi i am using Cygnal development kit C8051F320 - TB.
    I want to communicate it with LabVIEW.
    Some members in discussion forum earlier have posted queries regarding communication with LabVIEW to USBExpress development kit from Cygnal.
    My question is, " is it possible to use same DLL (sif32xusb.dll) supplied with USBExpress with this kit ? " .
    If anybody has tried then please send me vi along with firmware.
    Thanking you
    Ishant

    Hello Ishant,
    Based in the excerpt from the USBXpress programming guide, you should be able to:
    "The Silicon Laboratories USBXpress Development Kit provides a complete host and device software solution for
    interfacing Silicon Laboratories C8051F32x microcontrollers to the Universal Serial Bus (USB). No USB protocol or
    host device driver expertise is required. Instead, a simple, high-level Application Program Interface (API) for both
    the host software and device firmware is used to provide complete USB connectivity."
    It looks like aa1982 got it working on this post:
    usb communication with silicon lab c8051f320
    And both are using the C8051F32x series controllers, you may want to get in contact with the owner of that thread to see if he encountered any problems.
    Xaq

  • Spy TCP/IP with Labview

    I'm intensively using Labview as a test platform for communication
    interfaces
    Currently I've a serial spy decoding HDLC which works quite well
    I need also to perform some traces on TCP/IP
    WhichVI should I use ? How do I have to configure it ?
    Many Thanks

    Hi,
    I recently work on it. Even if I have some difficult I wrote a dll using
    Libpcap ( see winpcap.polito.it but it can't be used by LV6 ) and the
    associate vi. These run with NT4. My problems now are to decode these
    ethernet frames to something usefull like in ethereal or somethink else.
    Give your e-mail I'll send you all I do but I can't say when.
    Eric
    "pfg158" a ecrit dans le message de news:
    [email protected]..
    > I would like to decode ethernet frames betwenn two equipements.
    > So, I'm a quite newbie with Labview and it's seems to be not so easy
    > to use dll's in Labview.
    >
    > I look for a tool (vi using a dll?) that give me all ethernet frames
    > transmitted between two equipements.

Maybe you are looking for

  • PDF in Internet Explorer 8

    Our web site has a large amount of interactive and non interactive pdf. Our clients download these files on a daily basses. Since the begging of the week we experiencing a problem viewing the full pdf in Internet Explorer 8. It happens in other brows

  • HT1351 Is ripped music from a CD or downloaded for free legitimately from the artist no longer playable on iphones/pads/pods?

    When syncing my Iphone it appears that any music that I ripped from a CD or downloaded from the artists's website is now unplayable on my iphone.  Did Apple change their policies so that I can no longer listen to it from my phone?  I can still listen

  • I can't paste in Photoshop CS6

    I'm probably missing something obvious, but I can't figure this out. I created a selection around a face in one photo, then copied it and tried to paste it into another photo, but it won'd paste no matter what I try. The photo I'm copying from is onl

  • N95-2 Maps data missing

    Hi, I had downloaded Asia and Europe maps 2 days ago. It was working fine this morning but then all the maps data disappeared. I can only see the green background and the landmarks....... have anyone encountered this problem ? N95-2, RM-320, V31.0.01

  • When will iTunes be able to be used on Android products?

    When will iTunes be able to be used on Android products?