Internet Protocol
Unreal Engine Plugin

TCP Server

How to use TCP server class

References

#include "tcp/tcpserver.h"

How to use

Blueprint: search by GetInternetProtocolSubsystem and call CreateTCPServer function

C++: Use the code bellow

#include "tcp/tcpserver.h"

UTCPServer* net = NewObject<UTCPServer>();

Variables

Backlog

  • Set/Get the maximum number of simultaneous client connections the server will accept in queue.
Backlog
Output pin

Nodes

Is Open

  • Return true if socket is open.
𝑓
Is Open
Return Value
Output pin

Local Endpoint

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

Clients

  • Gets a constant reference to the set of clients connected to the server.
𝑓
Clients
Return Value
Output pin

Get Error Code

  • Return a struct of the latest error code returned by asio.
𝑓
Get Error Code
Return Value
Output pin

Open

  • Opens the TCP server and starts listening for incoming connections.
  • It returns false if socket is already open or if asio return any error code during the bind.
𝑓
Open
Target is TCPServer
Input pin
Input pin
Target
Input pin
Bind Opts
Output pin
Return Value
Output pin

Close

  • Close the underlying socket and stop listening for data on it. 'on_close' event will be triggered.
𝑓
Close
Target is TCPServer
Input pin
Input pin
Target
Output pin

Events

On Listening

  • This event will be triggered when socket start to listening.
Bind Event to On Listening
Input pin
Input pin
Target
Input pin
Event
Output pin
On Listening
Custom Event
Output pin

On Client Accepted

  • This event will be triggered when new client connect.
Bind Event to On Client Accepted
Input pin
Input pin
Target
Input pin
Event
Output pin
On Client Accepted
Custom Event
Output pin
Client
Output pin

On Close

  • Event triggered when socket is closed.
Bind Event to On Close
Input pin
Input pin
Target
Input pin
Event
Output pin
On Close
Custom Event
Output pin

On Error

  • Event triggered if any error occur during async process.
Bind Event to On Error
Input pin
Input pin
Target
Input pin
Event
Output pin
On Error
Custom Event
Output pin
Error Code
Output pin