Skip to Content
Internet Protocol
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 MB behind, 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
Pure function

Local Endpoint

  • Get the local endpoint of the socket. Use this function only after open connection.
Local Endpoint
Return Value
Pure function

Remote Endpoint

  • Get the remote endpoint of the socket. Use this function only after open connection.
Remote Endpoint
Return Value
Pure function

Get Error Code

  • Return a struct of the latest error code returned by asio.
Get Error Code
Return Value
Pure function

Set Recv Buffer Size

  • Set receive buffer size in bytes
Set Recv Buffer SizeTarget is UDPClient
Target
Value
Function

Get Max Send Buffer Size

  • Get receive buffer size in bytes
Get Recv Buffer SizeTarget is UDPClient
Target
Return Value
Pure function

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
Function
On Message SentCustom Event
Error Code
Bytes Sent
Event

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
Function
On Message SentCustom Event
Error Code
Bytes Sent
Event

Connect

  • Resolve the address and connect asynchronously. On Connected is triggered when the connection is established, On Error if 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 Port in the Client Bind Options.
ConnectTarget is UDPClient
Target
Bind Opts
Return Value
Function

Close

  • Close the underlying socket and stop listening for data on it. 'on_close' event will be triggered.
CloseTarget is UDPClient
Target
Function

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.255 or 192.168.1.255).
Set BroadcastTarget is UDPClient
Target
Enable
Function

Join Multicast Group

  • Joins a multicast group, for example 239.0.0.1 or ff02::1. Returns false on error.
Join Multicast GroupTarget is UDPClient
Target
Group Address
Return Value
Function

Leave Multicast Group

  • Leaves a multicast group joined with Join Multicast Group.
Leave Multicast GroupTarget is UDPClient
Target
Group Address
Return Value
Function

Set Multicast TTL

  • Number of network hops multicast datagrams may cross (1 = local network only).
Set Multicast TTLTarget is UDPClient
Target
Hops
Function

Set Multicast Loopback

  • Whether this machine also receives the multicast datagrams it sends.
Set Multicast LoopbackTarget is UDPClient
Target
Enable
Function

Events

On Connected

  • Event triggered when a connection is estabilished.
Bind Event to On Connected
Target
Event
On ConnectedCustom Event
Event binding

On Message

  • Event triggered when socket send or receive data.
Bind Event to On Message
Target
Event
On MessageCustom Event
Buffer
Bytes Recvd
Event binding

On Close

  • Event triggered when socket is closed.
Bind Event to On Close
Target
Event
On CloseCustom Event
Event binding

On Error

  • Event triggered if any error occur during async process.
Bind Event to On Error
Target
Event
On ErrorCustom Event
Error Code
Event binding
Edit on GitHub

On this page