# XPlaneConnect Toolbox-readUDP

<-- Back

# readUDP

Read Array from UDP Socket

## Inputs

- location: Either an opened UDP Socket or integer port number

## Outputs

- data: UDP uint8 Array. Equal to -998 in the case of an error.

## Use

1. import XPlaneConnect.*;
2. socket = openUDP(49005);
3. data = readUDP(socket);
4. status = closeUDP(socket);
or
1. import XPlaneConnect.*;
2. data = readUDP(49005);

## Note

NOTE: sending in a port number instead of an opened socket clears the UDP buffer. This only works if the data is being sent at a fast rate. Sending in a UDP Socket reads the first packet in the buffer.

## Change Log

10/02/14: [CT] V0.9: Updated to work with updated xpcPlugin
09/08/13: [CT] Added option for either UDP Socket or port number input
06/10/13: [CT] Code created
<-- Back