FAST SDK Coding Reference 1.0.3
|
Provides methods to communicate over User Datagram Protocol (UDP). More...
Public Member Functions | |
bool | Open () |
Opens a UDP connection. | |
void | Send (byte[] data) |
Sends a datagram to FAST.UdpConnection.remoteIpAddress on FAST.UdpConnection.remotePort. | |
Public Attributes | |
string | id |
Settings, Inspector, Code Identifies this instance. | |
bool | isLogging = true |
Inspector, Code Set to true if all UDP activity should be logged to the Editor Console or Player log. | |
int | localReceivePort = 60000 |
Settings, Inspector, Code The port of the local computer to recieve data on. | |
int | localSendPort = 60001 |
Settings, Inspector, Code The port of the local computer to send data from. | |
UnityAction< byte[]> | onDataReceivedEvent |
Inspector, Code Calls the function(s) subscribed to this UnityAction when a datagram is received. | |
string | remoteIpAddress = "0.0.0.0" |
Settings, Inspector, Code The IP address of the remote computer to communicate with. | |
int | remotePort = 50000 |
Settings, Inspector, Code The port of the remote computer to send data to. | |
Properties | |
List< byte[]> | Data [get] |
Gets the list of datagrams recieved since the last read. | |
Private Attributes | |
bool | isEnableBroadcast = true |
Inspector Set to true if UDP messages should be broadcast to a subnet. | |
bool | isOverwrite = false |
Inspector Set to true if incoming the datagram should overwrite the previous datagram. Otherwise the datagram will added to FAST.UdpConnection.Data in the order it is recieved. | |
Provides methods to communicate over User Datagram Protocol (UDP).
Receiving data is threaded for high-performance.
bool Open | ( | ) |
Opens a UDP connection.
The connection is initialized by binding the local send and receive ports. Also, a Thread
is started if one doesn't exist.
true
if successful, else false
Open()
and configuring a FAST.UdpConnection yourself, FAST.UdpConnectionLoader and FAST.UdpConnectionSettings should be used to open a UDP connection with settings from file during the application load screen. void Send | ( | byte[] | data | ) |
Sends a datagram to FAST.UdpConnection.remoteIpAddress on FAST.UdpConnection.remotePort.
data | The datagram to send. |
string id |
Settings, Inspector, Code
Identifies this instance.
Loaded from FAST.UdpConnectionSettings at runtime.
|
private |
Inspector
Set to true
if UDP messages should be broadcast to a subnet.
This functions the same as UdpClient.EnableBroadcast
.
bool isLogging = true |
Inspector, Code
Set to true
if all UDP activity should be logged to the Editor Console or Player log.
Recieved messages are not logged because the communication may be too frequent.
|
private |
Inspector
Set to true
if incoming the datagram should overwrite the previous datagram. Otherwise the datagram will added to FAST.UdpConnection.Data in the order it is recieved.
int localReceivePort = 60000 |
Settings, Inspector, Code
The port of the local computer to recieve data on.
Loaded from FAST.UdpConnectionSettings at runtime.
int localSendPort = 60001 |
Settings, Inspector, Code
The port of the local computer to send data from.
Loaded from FAST.UdpConnectionSettings at runtime.
UnityAction<byte[]> onDataReceivedEvent |
Inspector, Code
Calls the function(s) subscribed to this UnityAction
when a datagram is received.
string remoteIpAddress = "0.0.0.0" |
Settings, Inspector, Code
The IP address of the remote computer to communicate with.
Loaded from FAST.UdpConnectionSettings at runtime.
int remotePort = 50000 |
Settings, Inspector, Code
The port of the remote computer to send data to.
Loaded from FAST.UdpConnectionSettings at runtime.
|
get |
Gets the list of datagrams recieved since the last read.
The list of datagrams is ordered from oldest to newest. If FAST.UdpConnection.isOverwrite is true
, the list only has 1 element.
After reading, the list is cleared from FAST.UdpConnection.