NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
cessaro@ptwc.noaa.gov
Posts: 2
0 Kudos

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.
Member
B & C Duffey
Posts: 39
0 Kudos

Re: tcp/ip communication with LabVIEW

This is an easy one for LabVIEW I use TCP/IP in may of my applications - I
don't think I have ever used an application that was as easy to use as
LabVIEW for TCP/IP and UDP. You can even use it for communication between
separate LabVIEW applications on the same computer. If you want to see an
example program that uses TCP/IP checkout my web page
http://ddi.digital.net/~duffey/LabVIEW.html and take a look at an FTP server
I wrote entirely with LabVIEW native TCP/IP vi's (no dll's or CINs)

Chris

cessaro@ptwc.noaa.gov wrote in message <7le0c5$pru$1@nnrp1.deja.com>...
>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
>appl
ication would open a socket (port and IP known ahead of time) and
>send a character to that socket.
Member
Rick Nelson
Posts: 55
0 Kudos

Re: tcp/ip communication with LabVIEW

Yeah, this is definately possible -- and not too hard. In my network VI's,
I use byte arrays and convert them to strings, then append headers (put
them all in the form of strings). You can them change them all back on the
recieving side to DBL, I32... etc.

It may (or may not) involve a few conversions, but it's definately not hard
to use the TCP/IP VI's provided by LabVIEW>

Rick
--

rick@csciences.com

Chesapeake Sciences Corp.
1127B Benfield Blvd Millersville, MD 21108

Tel: (410) 923-1300 x3430 Fax: (410) 923-2669
Member
Armando Garcia
Posts: 3
0 Kudos

Re: tcp/ip communication with LabVIEW

lab View has some examples about TCp, you can use the one named Talk
Passive or Talk Active. It has all necesary to do a simple communication
like you want

Armando Garcia Lopez
iDEA S.A de C.V.

Chihuahua, Chih., Mexico
Member
osowoaji
Posts: 43
0 Kudos

Re: tcp/ip communication with LabVIEW

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

Trusted Enthusiast
nathand
Posts: 3,881

Re: tcp/ip communication with LabVIEW

Probably better to start a new thread rather than adding to one that last saw activity more than a decade ago...

 

The error you're seeing is because, in the server, you wired the "Listener ID out" terminal instead of the "Connection ID out" to the TCP write.

 

You'll want to put some sort of wait in your VI; a loop with no wait will spin as fast as possible, consuming all available processor time and preventing other code from responding.

Member
osowoaji
Posts: 43
0 Kudos

Re: tcp/ip communication with LabVIEW

Thanks Nathand,it worked :smileyhappy:.Do you have an email i can reach you at incase i encounter another problem as this is the first and very tiny step to what i will be hoping to do.Thanks again

 

Osowoaji

Trusted Enthusiast
nathand
Posts: 3,881

Re: tcp/ip communication with LabVIEW

If you run into problems, post your questions to the forum.  You'll get better advice because more people will reply, and other users will benefit from having that information available publicly.

Member
osowoaji
Posts: 43
0 Kudos

Re: tcp/ip communication with LabVIEW

Hi guys,i was able to send a string and receive them at the client side.I have upgraded a little now trying to send a sine pattern but think there is a problem.I dont have any error message per say but i am not getting what i see on the server side on the client side.I will attach the VI so it can be view and hopefully what im doing wrong would be spotted.Thanks guys

 

Osowoaji

Trusted Enthusiast
nathand
Posts: 3,881
0 Kudos

Re: tcp/ip communication with LabVIEW

There are two problems here:

1) The server sends 128 samples * 8 bytes/sample = 1024 bytes, but the client only reads 8 bytes.  This can work, especially if the client runs faster than the server, but it would be better to read all the data at once.

2) The range of the X axis of the chart is not long enough.  You're getting the sine wave, you just can't see it.  Try setting the X axis to autoscale.