-
Notifications
You must be signed in to change notification settings - Fork 4
PDUReceiver
The PDU Receiver is required for setting up UDP receive sockets.
public class PDUReceiver
: MonoBehaviour
Access | Type | Name | Description | |
---|---|---|---|---|
Public | bool | allowLoopback | Whether or not packets sent by the local machine should be processed. | |
Public | bool | autoConnectAtStart | Whether or not to auto connect the receive address on start. | |
Private | DISGameManager | disManagerScript | A reference to the DISGameManager script | |
Private | IPAddress | ipAddress | The .Net container for the IP Address to use for receiving UDP messages. | |
Public | string | ipAddressString | The IP Address to receive UDP packets from. An IP Address of 0.0.0.0 listens to all connection on the specified port. | |
Public | string | multicastAddress | The multicast address to receive UDP packets from. DIS transient multicast groups range from 224.252.0.0 - 224.255.255.255 per IANA standards. | |
Private | PDUProcessor | pduProcessor | A reference to the PDUProcessor script. | |
Public | int | port | The Port to receive UDP packets from. Valid Port ranges are from 1024 to 65535. | |
Private | UDPReceiverMulti | receiver | The UDP Receiver Multi class that this PDU Receiver is registered to. | |
Public | bool | useMulticast | Whether or not multicast should be used with this receive socket. |
Event Type | Event Name | Description |
---|---|---|
UnityEvent<Exception> | OnFailedToConnect | Called if the UDP receiver fails to connect to the given IP Address/Port. |
Access | Return | Name | Description | |
---|---|---|---|---|
Public | void | FailedToConnect(Exception ex) | Called when the UDP receiver fails to connect to the given IP Address/port. | |
Private | void | OnApplicationQuit() | Sent to all GameObjects before the application quits. Unity calls this message when play mode is stopped. | |
Private | void | ProcessDISPacket(Pdu PDUPacketToProcess) | Process newly received DIS PDU packets. | |
Private | void | Start() | Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. | |
Public | void | startUDPReceiver() | Initializes the UDP Receiver with the specified variables and begins listening for UDP messages. | |
Public | void | stopUDPReceiver() | Stops the UDP receiver. | |
Private | void | Update() | Update is called every frame, if the MonoBehaviour is enabled. |
public bool allowLoopback = false
Whether or not packets sent by the local machine should be processed.
public bool autoConnectAtStart = true
Whether or not to auto connect the receive address on start.
private DISGameManager disManagerScript
A reference to the DISGameManager script
private IPAddress ipAddress
The .Net container for the IP Address to use for receiving UDP messages.
public string ipAddressString = "0.0.0.0"
The IP Address to receive UDP packets from. An IP Address of 0.0.0.0 listens to all connection on the specified port.
public string multicastAddress = "224.252.0.1"
The multicast address to receive UDP packets from. DIS transient multicast groups range from 224.252.0.0 - 224.255.255.255 per IANA standards.
private PDUProcessor pduProcessor
A reference to the PDUProcessor script.
public int port = 3000
The Port to receive UDP packets from. Valid Port ranges are from 1024 to 65535.
private UDPReceiverMulti.UDPReceiverMulti receiver
The UDP Receiver Multi class that this PDU Receiver is registered to.
public bool useMulticast = false
Whether or not multicast should be used with this receive socket.
public UnityEvent<Exception> OnFailedToConnect
Called if the UDP receiver fails to connect to the given IP Address/Port.
Parameter | Description |
---|---|
Exception | The exception that contains the reasoning behind why the UDP receiver failed to connect. |
public void FailedToConnect
(
Exception ex
)
Called when the UDP receiver fails to connect to the given IP Address/port.
Parameter | Description |
---|---|
Exception | The exception that contains the reasoning behind why the UDP receiver failed to connect. |
private void OnApplicationQuit()
Sent to all GameObjects before the application quits. Unity calls this message when play mode is stopped.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationQuit.html
private void ProcessDISPacket
(
Pdu PDUPacketToProcess
)
Process newly received DIS PDU packets.
Parameter | Description |
---|---|
PDUPacketToProcess | The PDU packet to process to determine the type of. |
private void Start()
Start is called on the frame when a script is enabled just before any of the Update methods are called the first time.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
public void startUDPReceiver()
Initializes the UDP Receiver with the specified variables and begins listening for UDP messages.
public void stopUDPReceiver()
Stops the UDP receiver.
void Update()
Update is called every frame, if the MonoBehaviour is enabled.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html