Interface IUdpCore
Namespace: Tool.Sockets.UdpHelper
Assembly: Tool.Net.dll
Udp通信核心,管理相关连接信息
public interface IUdpCore : IAsyncDisposableImplements
Extension Methods
ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Properties
DataLength
可用最大空间
int DataLength { get; }Property Value
EndPoint
连接的设备地址信息
UdpEndPoint EndPoint { get; }Property Value
Ipv4
获取IpV4地址信息
Ipv4Port Ipv4 { get; }Property Value
LimitingSize
控制滑动窗口大小(限制流量)备注:计算得出1000个窗口比较满足大多数环境
public static int LimitingSize { get; set; }Property Value
OnlyData
是否保证数据唯一性,开启后将采用框架验证保证其每次的数据唯一性,(如果不满足数据条件将直接与其断开连接)
bool OnlyData { get; }Property Value
Socket
连接的对象(请勿脱离框架使用,避免出现各种未知异常)
Socket Socket { get; }Property Value
SpinWaitTimeout
分配id最大等待时间
public static int SpinWaitTimeout { get; set; }Property Value
Methods
CloseAsync()
尝试异步关闭连接
Task CloseAsync()Returns
GetUdpCore(INetworkCore, UdpEndPoint, Socket, int, bool, int, bool, bool, Func<UserKey, byte, ValueTask>, ReceiveEvent<IUdpCore>)
创建可用的公共UDP核心
public static IUdpCore GetUdpCore(INetworkCore networkCore, UdpEndPoint endPoint, Socket socket, int dataLength, bool onlyData, int replyDelay, bool isserver, bool isp2p, Func<UserKey, byte, ValueTask> complete, ReceiveEvent<IUdpCore> received)Parameters
networkCore INetworkCore
endPoint UdpEndPoint
socket Socket
dataLength int
onlyData bool
replyDelay int
isserver bool
isp2p bool
complete Func<UserKey, byte, ValueTask>
received ReceiveEvent<IUdpCore>
Returns
SendAsync(Memory<byte>)
直接发送数据(警告非对内核完全了解的开发者,请谨慎,会出现各种未知异常!)
Task SendAsync(Memory<byte> memory)Parameters
发送的数据