Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

IrDA Write Function

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Owning Palette: IrDA Functions

Requires: Base Development System (Windows)

Sends string data to the IrDA connection specified by connection ID.


connection ID is an IrDA connection refnum that uniquely identifies the IrDA connection.
data in is the data the function writes to an IrDA device. The data must be a string or a flattened string. Use the Flatten To String function to convert any data that is not a string to the string format. You must then use the Unflatten From String function to unflatten the string on the remote computer. You also can use the Flatten To XML function to convert data to XML format.

Use one of the following techniques to handle messages that might vary in size:
  • Send messages that are preceded by a fixed size header that describes the message. For example, it might contain a command integer that identifies what kind of message follows and a length integer that identifies how much more data is in the message. Both the server and client receive messages by issuing a read function of eight bytes (assuming each is a four byte integer), converting them into the two integers, and using the length integer to determine the number of bytes to pass to a second read function for the remainder of the message. Once this second read is complete, each side loops back to the read function of the eight byte header. This technique is the most flexible, but it requires two reads to receive each message. In practice, the second read usually completes immediately if the message is written with a single write function.
  • Make each message a fixed size. When the content of a message is smaller than the fixed size you specify, pad the message to the fixed size. This technique is marginally more efficient because only a single read is required to receive a message at the expense of sending unnecessary data sometimes.
  • Send messages that are strictly ASCII in content, where each message is terminated by a carriage return and linefeed pair of characters. The read function has a mode input that, when passed CRLF, causes it to read until seeing a carriage return and linefeed sequence. This technique becomes more complicated when message data can possibly contain CRLF sequences, but it is quite common among many internet protocols, including POP3, FTP, and HTTP.
timeout ms specifies the time, in milliseconds, for the function to write bytes to a device before the function completes and returns an error. The default value is 25,000 ms. A value of –1 indicates to wait indefinitely.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
connection ID out is the IrDA connection refnum that uniquely identifies the IrDA connection. Use this value to refer to this connection in subsequent IrDA function calls. connection ID out always has the same value as connection ID.
bytes written indicates the number of bytes the function wrote.
error out contains error information. This output provides standard error out functionality.


Refer to the following VIs for examples of using the IrDA Write function:

  • labview\examples\Data Communication\Protocols\IrDA\Simple IrDA\Simple IrDA.lvproj
  • labview\examples\Data Communication\Protocols\IrDA\Simple IrDA\Simple IrDA.lvproj


Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit