TCPClient make easy to connect and comunicate with your server via TCP Socket.
You can easily implement all the functions by learning how to use 4 blueprints.
Because of It is only maden by C++17 and unreal libray, any device that supports multi-threading can be used.
- All features can be created using blueprints.
- Only c++ can be used for optimization.
- Connect to the server via TCP Socket
- Supports multiple connections with various servers.
- Support type : bool, int8, int16, int32, int64, float, double(c++ only), String(utf-8) and bytes array.
- Each packet is managed with a Blueprint or C++ Class.
- Not Polling method. It can save cpu usage.
- TCPClientSubsystem : Subsystem is responsible for creating and destroying sessions. You can get the sessions that you created through this.
- TCPClientSessionBase : The session manages communication with the connected server.
- TCPRecvPacketBase : It defines the packets to be received from the server.
- TCPSendPacketBase : It defines the packets to be sent to the server.
Expand
- Session Name : 'SessionName' is required when get the session from Subsystem. So, you must input unique value
- Ip : IP Address of server. If you check DNS, it will be treated as a DNS Address
- Port : Port of server
- Custom Header : You can set a custom header. If set to None, the default settings will be applied.
- packet to Receive : Register your created RecvPacket. This will enable you to convert and respond to the byte messages received from the server.
Expand
- The session converts to the RecvPacket that matches this Id
Expand
- This is the Id of the packet you will send, and it will be included in the header
- You can use 'CreateSendPacket' method to instantiate SendPacket, and set member after casting it.
- Call 'SendPacket' method of Session. Then packet is sended to server that relative with session
Expand
- The same applies to the Disconnected Delegate.
Expand
5-1) Now, you can obtain the session connected to the server anytime and anywhere through the TCPClientSubsystem's 'GetSession' method.
- Communicate with the server through this connected session
Inherit from TCPHeaderComponent.h to configure a header suitable for your server environment.
Refer to the comments in the code for more details.
Serialize the 2-byte number representing the byte length of the string, followed by the string itself.