Plugin Documentation

BlueprintTCP
TCP client for Unreal, from Blueprints

Open raw TCP connections and exchange byte streams with any server — entirely from Blueprints (or C++). Multiple connections, each on its own background thread, with game-thread-safe events.

v1.0.0
UE 4.27–5.0+
Win64 · Linux · Mac
Category Networking
Alpha XP
BlueprintTCP diagram
BlueprintTCP — architecture & feature overview

Overview

BlueprintTCP is a lightweight UE 4.27–5.0+ plugin that lets you connect to any TCP server and exchange data entirely from Blueprints (C++ is also supported). Place one BlueprintTCP Connection actor, call Connect, and send/receive arbitrary byte streams to game backends, IoT devices, chat servers, hardware bridges, or any TCP endpoint.

Each connection runs on its own background thread, so blocking socket I/O never stalls the game thread. Incoming data is marshalled back to the game thread and delivered through Blueprint events. One actor can manage many simultaneous connections, each addressed by a ConnectionId.

Fork note This is the BlueprintTCP fork: module and classes were renamed for UE 4.27–5.0+, with added multi-connection helpers and a SendString convenience over the original single-socket foundation.

Requirements

RequirementDetails
Unreal Engine4.27–5.0+
ModulesSockets, Networking — engine built-ins, nothing to install
LanguageBlueprints and/or C++
PlatformsWin64, Linux, Mac

Installation

  1. Copy the BlueprintTCP folder into your project's Plugins/ directory.
  2. C++ projects: right-click the .uprojectGenerate Visual Studio project files, then build. Blueprint-only projects can launch the editor directly.
  3. Open Edit → Plugins → Networking, confirm BlueprintTCP is enabled, and restart if prompted.

Quick Start (Blueprints)

  1. Place the actor. Drag a BlueprintTCP Connection actor into the level (or Spawn Actor from Class). Keep a reference.
  2. Connect. Call Connect with IP, port, and three bound events; store the output Connection Id.
  3. Send. Use Send String for text, or build a byte array and call Send Data.
  4. Receive. Your On Message Received event fires on the game thread; drain it with the Read nodes.
  5. Clean up. Disconnect / Disconnect All (also auto-closed on EndPlay).
Event BeginPlay
 └─ Connect (Conn, "127.0.0.1", 7777, OnDisc, OnConn, OnMsg)  →  set ConnId

Event OnConn (ConnId)
 └─ Send String (Conn, ConnId, "HELLO\n")

Event OnMsg (ConnId, Message)
 ├─ Length = Read Int (Message)
 ├─ Text   = Read String (Message, Length)
 └─ Print String (Text)

API — Connection management

NodeTypeDescription
ConnectCallableOpen a connection to ipAddress:port; binds the three delegates; returns a new ConnectionId.
DisconnectCallableClose the connection with the given ConnectionId.
Disconnect AllCallableClose every active connection on this actor.
Is ConnectedPuretrue while the given ConnectionId is connected.
Get Active Connection CountPureNumber of connections currently tracked.
Get Active Connection IdsPureArray of all active ConnectionIds.

API — Events

Bind these when you call Connect. All fire on the game thread.

DelegateSignatureWhen
On Connected Event(int32 ConnectionId)The socket finished connecting.
On Disconnected Event(int32 ConnectionId)The socket closed (remote, error, or Disconnect).
On Message Received Event(int32 ConnectionId, TArray<uint8>& Message)Bytes arrived; drain with the Read nodes.

API — Sending

NodeReturnsDescription
Send DataboolSend a raw byte array on a ConnectionId. false = not connected. true = sent while connected (not a delivery guarantee).
Send StringboolConvenience: UTF-8 encode a string and send it. Returns the result of Send Data.

API — Building byte arrays (pure)

NodeDisplayNotes
Append BytesA + BConcatenate two byte arrays.
Byte To Bytes->Single byte → 1-element array.
Int To Bytes->int32 → 4 bytes.
Int64 To Bytes->int64 → 8 bytes.
Float To Bytes4->float → 4 bytes.
String To Bytes->FString → bytes.
C++ only Conv_ShortToBytes (int16) and Conv_DoubleToBytes (double) — those types aren't Blueprint types in UE 4.27–5.0+.

API — Reading received messages

Each Read node consumes bytes from the front of Message (passed by ref), so call them in your protocol's order.

NodeReturnsDescription
Read Bytesbool + arrayRead NumBytes raw bytes.
Read Byteuint8Read one byte.
Read Intint32Read 4 bytes as an integer.
Read Int64int64Read 8 bytes as a 64-bit integer.
Read FloatfloatRead 4 bytes as a float.
Read StringFStringRead StringLength bytes as a string.
C++ only Message_ReadShort (int16) and Message_ReadDouble (double).

Utility node pack

General-purpose networking utilities on UBlueprintTCPLibrary — available from Blueprints and C++.

NodeTypeDescription
CRC32 Of BytesPureCRC32 checksum of a byte array.
MD5 Of String / SHA1 Of StringPureHex digests of a UTF-8 string.
Make Guid StringPureNew random GUID (hyphenated).
Now Unix SecondsPureCurrent UTC time as Unix seconds.
Unix Seconds To ISO8601PureUnix seconds → ISO-8601 UTC string.
Format Byte SizePureHuman-readable size, e.g. 1536 → 1.5 KB.
Random TokenPureRandom alphanumeric token (ids, nonces).
XOR Bytes With KeyPureXOR bytes with a repeating key (obfuscation, not encryption).
Is Valid HostnamePureRFC-952/1123-style hostname validation.

Tunables (actor properties)

PropertyDefaultDescription
Receive Buffer Size16384Socket receive buffer in bytes (applied at socket creation).
Send Buffer Size16384Reserved; currently not used.
Time Between Ticks0.008Worker-thread poll interval (s). ~1 ms wake-up overhead applies.

C++ Usage

Include BlueprintTCPConnection.h and use ABlueprintTCPConnection directly:

int32 ConnId = 0;
FBlueprintTCPDisconnectDelegate OnDisc; OnDisc.BindUFunction(this, FName("HandleDisconnected"));
FBlueprintTCPConnectDelegate    OnConn; OnConn.BindUFunction(this, FName("HandleConnected"));
FBlueprintTCPReceivedMessageDelegate OnMsg; OnMsg.BindUFunction(this, FName("HandleMessage"));

Connection->Connect(TEXT("127.0.0.1"), 7777, OnDisc, OnConn, OnMsg, ConnId);
Connection->SendString(ConnId, TEXT("ping\n"));

Add "Sockets" and "Networking" to your module dependencies if you touch the worker layer directly.

How It Works

Each Connect spins up an FBlueprintTCPWorker (FRunnable) on its own thread with an incrementing ConnectionId. The worker performs the blocking connect/receive; data moves between threads via lock-free single-producer/single-consumer queues (inbox worker→game, outbox game→worker). The actor's Tick drains the inbox and fires Blueprint events on the game thread.

Worker callbacks carry a TWeakObjectPtr back to the actor, so stopping PIE mid-connect (a blocking timeout) can never dereference freed memory.

Project Settings

Project Settings → Plugins → BlueprintTCP

SettingDescription
Post Errors To Message LogWhen enabled, socket errors are written to the editor Message Log.

Troubleshooting

Connect never fires On Connected The server isn't reachable — check IP/port, that the server is listening, and firewall rules. The blocking connect can take a few seconds to time out.
Send Data returns false The connection is down. Check Is Connected first, and use the ConnectionId returned by Connect.
Received data is garbled / split TCP is a stream, not a message protocol — one event may carry partial or multiple logical messages. Length-prefix your messages (Int To Bytes + Read Int + Read Bytes/Read String).
Editor hitches when stopping PIE A connection was still establishing (blocking). It resolves on timeout; weak-pointer guards prevent any crash.