// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Platform/Network.h"
class ScriptingObject;
///
/// Network driver implementations enum.
/// [Deprecated in v1.3]
///
API_ENUM(Namespace="FlaxEngine.Networking") enum class DEPRECATED NetworkDriverType
{
///
/// Invalid network driver implementation.
///
Undefined = 0,
///
/// ENet library based network driver implementation.
///
ENet
};
///
/// Low-level network configuration structure. Provides settings for the network driver and all internal components.
///
API_STRUCT(Namespace="FlaxEngine.Networking") struct FLAXENGINE_API NetworkConfig
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConfig);
///
/// The network driver that will be used to create the peer.
/// To allow two peers to connect, they must use the same host.
/// [Deprecated in v1.3]
///
API_FIELD()
DEPRECATED NetworkDriverType NetworkDriverType = NetworkDriverType::ENet;
///
/// The network driver instance (implements INetworkDriver) that will be used to create and manage the peer, send and receive messages.
///
/// Object is managed by the created network peer (will be deleted on peer shutdown).
API_FIELD()
ScriptingObject* NetworkDriver;
///
/// The upper limit on how many peers can join when we're listening.
///
API_FIELD()
uint16 ConnectionsLimit = 32;
///
/// Address used to connect to or listen at.
///
/// Set it to "any" when you want to listen at all available addresses.
/// Only IPv4 is supported.
API_FIELD()
String Address = String(TEXT("127.0.0.1"));
///
/// The port to connect to or listen at.
///
API_FIELD()
uint16 Port = 7777;
///
/// The size of a message buffer in bytes.
/// Should be lower than the MTU (maximal transmission unit) - typically 1500 bytes.
///
API_FIELD()
uint16 MessageSize = 1500;
///
/// The amount of pooled messages that can be used at once (receiving and sending!).
///
///
/// Creating more messages than this limit will result in a crash!
/// This should be tweaked manually to fit the needs (adjusting this value will increase/decrease memory usage)!
///
API_FIELD()
uint16 MessagePoolSize = 2048;
};