2023-06-23 16:27:23 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
2023-09-03 02:01:32 -04:00
|
|
|
#include "LockedWrapper.h"
|
2023-06-26 17:28:07 -04:00
|
|
|
#include <string>
|
2023-06-23 16:27:23 -04:00
|
|
|
|
2023-09-15 13:28:18 -04:00
|
|
|
// Class FlxSockets
|
2023-06-23 16:27:23 -04:00
|
|
|
//
|
|
|
|
|
// This class is responsible for creating outgoing and incoming
|
|
|
|
|
// sockets for the Luprex engine. It then relays data into and out
|
|
|
|
|
// of the Luprex engine.
|
|
|
|
|
//
|
|
|
|
|
// It only has one interesting method: Update(). This one method
|
|
|
|
|
// does all the communication for the Luprex engine. Note that
|
|
|
|
|
// there aren't any methods where Unreal can query the state
|
2023-09-15 13:28:18 -04:00
|
|
|
// of the FlxSockets. That's because this class is for
|
2023-06-23 16:27:23 -04:00
|
|
|
// communication between Luprex and outside servers and clients,
|
|
|
|
|
// NOT for communication with Unreal.
|
|
|
|
|
//
|
2023-09-15 13:28:18 -04:00
|
|
|
// The FlxSockets keeps a pointer to the EngineWrapper.
|
|
|
|
|
// The EngineWrapper must outlive the FlxSockets.
|
2023-06-23 16:27:23 -04:00
|
|
|
//
|
|
|
|
|
// This class is an abstract base class. A derived class
|
|
|
|
|
// implements all the behavior.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
struct EngineWrapper;
|
|
|
|
|
|
2023-09-15 13:28:18 -04:00
|
|
|
class FlxSockets
|
2023-06-23 16:27:23 -04:00
|
|
|
{
|
|
|
|
|
protected:
|
2023-09-15 13:28:18 -04:00
|
|
|
FlxSockets() {}
|
2023-06-23 16:27:23 -04:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Create the Luprex socket system.
|
2023-09-15 13:28:18 -04:00
|
|
|
static FlxSockets* Create(FlxLockedWrapper &w);
|
2023-06-23 16:27:23 -04:00
|
|
|
|
2023-09-03 02:01:32 -04:00
|
|
|
// Close all sockets.
|
2023-09-15 13:28:18 -04:00
|
|
|
virtual void ForceCloseEverything(FlxLockedWrapper& w) = 0;
|
2023-09-03 02:01:32 -04:00
|
|
|
|
|
|
|
|
// The update routine relays data into and out of
|
|
|
|
|
// luprex via TCP/IP sockets.
|
2023-09-15 13:28:18 -04:00
|
|
|
virtual void Update(FlxLockedWrapper& w) = 0;
|
2023-09-03 02:01:32 -04:00
|
|
|
|
|
|
|
|
// Delete the luprex socket system.
|
|
|
|
|
// You must call ForceCloseEverything first.
|
2023-09-15 13:28:18 -04:00
|
|
|
virtual ~FlxSockets() {}
|
2023-06-23 16:27:23 -04:00
|
|
|
|
2023-06-26 17:28:07 -04:00
|
|
|
// Obtain any error status report.
|
|
|
|
|
virtual std::string GetError() = 0;
|
2023-06-23 16:27:23 -04:00
|
|
|
};
|