Unreal Engine Plugin
UDP Client
UDP client for Unreal Engine: Blueprint nodes, events and C++ usage with the Internet Protocol plugin.
References
#include "udp/udpclient.h"
How to use
Blueprint: search by GetInternetProtocolSubsystem and call CreateUDPClient function
C++: Use the code bellow
#include "udp/udpclient.h"
UUDPClient* client = NewObject<UUDPClient>();Datagrams in 4.0
- The receive buffer is 64 KiB by default (16 KiB before). Datagrams that do not fit are dropped and counted instead of closing the socket.
- When the Game Thread falls more than
Max Pending Receive MBbehind, new datagrams are dropped. - Windows ICMP "port unreachable" resets (
WSAECONNRESET) no longer close the socket.
Nodes
Is Open
- Return true if socket is open.
Is Open
Return Value
Local Endpoint
- Get the local endpoint of the socket. Use this function only after open connection.
Local Endpoint
Return Value
Remote Endpoint
- Get the remote endpoint of the socket. Use this function only after open connection.
Remote Endpoint
Return Value
Get Error Code
- Return a struct of the latest error code returned by asio.
Get Error Code
Return Value
Set Recv Buffer Size
- Set receive buffer size in bytes
Set Recv Buffer SizeTarget is UDPClient
Target
Value
Get Max Send Buffer Size
- Get receive buffer size in bytes
Get Recv Buffer SizeTarget is UDPClient
Target
Return Value
Send
- Broadcasts a string to an specific endpoint.
- It returns false if socket is closed, if buffer is empty or if the send queue limit is exceeded.
SendTarget is UDPClient
Target
Message
Callback
Return Value
On Message SentCustom Event
Error Code
Bytes Sent
Send Buffer
- Broadcasts a buffer to an specific endpoint.
- It returns false if socket is closed, if buffer is empty or if the send queue limit is exceeded.
Send BufferTarget is UDPClient
Target
Buffer
Callback
Return Value
On Message SentCustom Event
Error Code
Bytes Sent
Connect
- Resolve the address and connect asynchronously.
On Connectedis triggered when the connection is established,On Errorif it fails. - It returns false if the socket is already open or connecting.
- Since 4.0 you can bind a local address and port before connecting with
Local Address/Local Portin the Client Bind Options.
ConnectTarget is UDPClient
Target
Bind Opts
Return Value
Close
- Close the underlying socket and stop listening for data on it. 'on_close' event will be triggered.
CloseTarget is UDPClient
Target
Broadcast and Multicast
New in 4.0. Errors of these nodes are reported through On Error.
Set Broadcast
- Allows sending to broadcast addresses (for example
255.255.255.255or192.168.1.255).
Set BroadcastTarget is UDPClient
Target
Enable
Join Multicast Group
- Joins a multicast group, for example
239.0.0.1orff02::1. Returns false on error.
Join Multicast GroupTarget is UDPClient
Target
Group Address
Return Value
Leave Multicast Group
- Leaves a multicast group joined with
Join Multicast Group.
Leave Multicast GroupTarget is UDPClient
Target
Group Address
Return Value
Set Multicast TTL
- Number of network hops multicast datagrams may cross (
1= local network only).
Set Multicast TTLTarget is UDPClient
Target
Hops
Set Multicast Loopback
- Whether this machine also receives the multicast datagrams it sends.
Set Multicast LoopbackTarget is UDPClient
Target
Enable
Events
On Connected
- Event triggered when a connection is estabilished.
Bind Event to On Connected
Target
Event
On ConnectedCustom Event
On Message
- Event triggered when socket send or receive data.
Bind Event to On Message
Target
Event
On MessageCustom Event
Buffer
Bytes Recvd
On Close
- Event triggered when socket is closed.
Bind Event to On Close
Target
Event
On CloseCustom Event
On Error
- Event triggered if any error occur during async process.
Bind Event to On Error
Target
Event
On ErrorCustom Event
Error Code