namespace LiteNetLib
{
///
/// Sending method type
///
public enum DeliveryMethod : byte
{
///
/// Unreliable. Packets can be dropped, can be duplicated, can arrive without order.
///
Unreliable = 4,
///
/// Reliable. Packets won't be dropped, won't be duplicated, can arrive without order.
///
ReliableUnordered = 0,
///
/// Unreliable. Packets can be dropped, won't be duplicated, will arrive in order.
///
Sequenced = 1,
///
/// Reliable and ordered. Packets won't be dropped, won't be duplicated, will arrive in order.
///
ReliableOrdered = 2,
///
/// Reliable only last packet. Packets can be dropped (except the last one), won't be duplicated, will arrive in order.
///
ReliableSequenced = 3
}
///
/// Network constants. Can be tuned from sources for your purposes.
///
public static class NetConstants
{
//can be tuned
public const int DefaultWindowSize = 64;
public const int SocketBufferSize = 1024 * 1024; //1mb
public const int SocketTTL = 255;
public const int HeaderSize = 1;
public const int ChanneledHeaderSize = 4;
public const int FragmentHeaderSize = 6;
public const int FragmentedHeaderTotalSize = ChanneledHeaderSize + FragmentHeaderSize;
public const ushort MaxSequence = 32768;
public const ushort HalfMaxSequence = MaxSequence / 2;
//protocol
internal const int ProtocolId = 11;
internal const int MaxUdpHeaderSize = 68;
internal static readonly int[] PossibleMtu =
{
576 - MaxUdpHeaderSize, //minimal
1232 - MaxUdpHeaderSize,
1460 - MaxUdpHeaderSize, //google cloud
1472 - MaxUdpHeaderSize, //VPN
1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042)
1500 - MaxUdpHeaderSize //Ethernet II (RFC 1191)
};
internal static readonly int MaxPacketSize = PossibleMtu[PossibleMtu.Length - 1];
//peer specific
public const byte MaxConnectionNumber = 4;
public const int PacketPoolSize = 1000;
}
}