Interface IDataPacket
Namespace: Tool.Sockets.Kernels
Assembly: Tool.Net.dll
通讯协议模型
public interface IDataPacket : IDisposableImplements
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
ActionID
事件ID
byte ActionID { get; }Property Value
ActionKey
获取对应消息Key
ushort ActionKey { get; }Property Value
BufferSize
int BufferSize { get; }Property Value
Bytes
携带字节包
Memory<byte> Bytes { get; }Property Value
ClassID
通道ID
byte ClassID { get; }Property Value
IpPort
当为转发时,转发给谁的IpPort
Ipv4Port IpPort { get; }Property Value
IsErr
当前包是否发生异常
bool IsErr { get; }Property Value
IsRelay
是否转发数据,默认不转发
bool IsRelay { get; }Property Value
IsReply
是否需要有回复消息
bool IsReply { get; }Property Value
IsSend
当前包是发包还是回复
bool IsSend { get; }Property Value
IsServer
消息是发送给那一端
bool IsServer { get; }Property Value
OnlyId
唯一ID
Guid OnlyId { get; }Property Value
Text
文本数据
string Text { get; }Property Value
TextBytes
文本流数据包
Span<byte> TextBytes { get; }Property Value
Methods
ByteData<T>(in SendBytes<T>, int)
获取完整字节流
void ByteData<T>(in SendBytes<T> sendBytes, int textSize)Parameters
sendBytes SendBytes<T>
textSize int
Type Parameters
T
Clone()
克隆完整副本
IDataPacket Clone()Returns
Exceptions
CopyTo(bool, bool)
拷贝当前数据
IDataPacket CopyTo(bool isbytes, bool istxet)Parameters
isbytes bool
istxet bool
Returns
GetAgentBytes<T>(T)
获取转发模式下专用数据对象
SendBytes<T> GetAgentBytes<T>(T client)Parameters
client T
Returns
SendBytes<T>
Type Parameters
T
Exceptions
ResetValue(bool?, bool?, Ipv4Port?)
设置发送状态
void ResetValue(bool? IsSend = null, bool? IsServer = null, Ipv4Port? IpPort = null)Parameters
IsSend bool?
IsServer bool?
IpPort Ipv4Port?
SetErr(string)
设置错误信息
void SetErr(string ex)Parameters
ex string
TotalSize(out int)
获取包总大小
int TotalSize(out int textSize)Parameters
textSize int