Jump to content

TCP/IP


Sarah83

Recommended Posts

Hi,

I like to know if it is possible to send some data via TCP/Ip with LV.

Are there some examples? Must I open one port for every data or could I send three signals over one? (synchro, ttl and audio)

1587[/snapback]

You can send all of these across the one connection. The trick here is to add a header byte to each packet so that your receiver (client) knows what to do with the packet. eg 0=synchro, 1=ttl, 2=audio, etc).

Just a note on the audio: you will need to buffer the audio on the client side to avoid having playback that has gaps in it. There is an interesting article in one of the recent LTR issues dealing with LabVIEW, sound and gapless buffered sound playback using the native LV sound VIs. Well worth a read.

cheers, Alex.

Link to comment
You can send all of these across the one connection. The trick here is to add a header byte to each packet so that your receiver (client) knows what to do with the packet. eg 0=synchro, 1=ttl, 2=audio, etc).

Just a note on the audio: you will need to buffer the audio on the client side to avoid having playback that has gaps in it. There is an interesting article in one of the recent LTR issues dealing with LabVIEW, sound and gapless buffered sound playback using the native LV sound VIs. Well worth a read.

cheers, Alex.

1618[/snapback]

Hi Alex,

LTR?

Do you have a link for me?

Now I'm just happy to have a connection :D

Link to comment
  • 1 year later...

The first question would be "how are you translating the number into a string?".

If you're simply flattening it, this may not help you outside of LabVIEW. Look at the LV data represntation paper available in the bookshelf (in the help menu) for more details.

One thing you can do is to convert the number to a string and then you can send that string.

The other thing to check is endianess. You may need to reverse the bit order of each byte in one of the sides. I think that if you want to do this in LV, you will have to convert the string to a byte array, convert those numbers to boolean arrays and reverse them and then convert back to a string, although there probably are other ways.

Link to comment
I'm using "Type Cast" to translate the value into a string......

Then convert it to a string using the number to string functions instead. Then, you can send the string.

Type cast simply takes the bit pattern (since a DBL is 8 bytes, that should be 64 bits) and reads those 64 bits as a string (of 8 characters, since each byte is an ASCII char). When you convert to a string, each digit will be turned into its ASCII value, which JAVA can easily understand.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.