A UE4 plugin wrapper for the ENet reliable UDP networking library. This plugin enables ENet usage inside Unreal Engine blueprints. It supports processing of network events on a separate network thread.
ENet was created by Lee Salzman as a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). The primary feature it provides is optional reliable, in-order delivery of packets. For more information on the details and features of ENet, check out the official ENet website.
Use the ENetCreateServer node to create an ENet server instance that can accept connections from clients. Bind events to OnConnect, OnDisconnect, and OnReceive to handle the network events. As soon as the CreateENetServer node returns, the server is running and can accept connections. If ServiceOnTick is false, the Service function must be called for the created instance manually and regularly in order to process network events.
Use the ENetCreateClient node to create an ENet client instance that can connect to a server instance. Bind events to OnConnect, OnDisconnect, and OnReceive to handle the network events. If ServiceOnTick is false, the Service function must be called for the created instance manually and regularly in order to process network events.
Use the ENetCreatePacket node to create an ENet packet instance that any type of data can be written to. The packet can then be sent using the server or client instance SendPacket function(s).
A better way to send and receive packets is to use blueprint Structs for each message type and write the struct to the packet instead of writing all the individual variables that make up the struct separately.
When handling packets, each packet should be read exactly as it was written to the packet. Peek can be used to see the contents of a packet buffer without moving the seek index.