Skip to content

Interface IDataPacket ​

Namespace: Tool.Sockets.Kernels
Assembly: Tool.Net.dll

通讯协议模型

csharp
public interface IDataPacket : IDisposable

Implements ​

IDisposable

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

csharp
byte ActionID { get; }

Property Value ​

byte

ActionKey ​

获取对应消息Key

csharp
ushort ActionKey { get; }

Property Value ​

ushort

BufferSize ​

csharp
int BufferSize { get; }

Property Value ​

int

Bytes ​

携带字节包

csharp
Memory<byte> Bytes { get; }

Property Value ​

Memory<byte>

ClassID ​

通道ID

csharp
byte ClassID { get; }

Property Value ​

byte

IpPort ​

当为转发时,转发给谁的IpPort

csharp
Ipv4Port IpPort { get; }

Property Value ​

Ipv4Port

IsErr ​

当前包是否发生异常

csharp
bool IsErr { get; }

Property Value ​

bool

IsRelay ​

是否转发数据,默认不转发

csharp
bool IsRelay { get; }

Property Value ​

bool

IsReply ​

是否需要有回复消息

csharp
bool IsReply { get; }

Property Value ​

bool

IsSend ​

当前包是发包还是回复

csharp
bool IsSend { get; }

Property Value ​

bool

IsServer ​

消息是发送给那一端

csharp
bool IsServer { get; }

Property Value ​

bool

OnlyId ​

唯一ID

csharp
Guid OnlyId { get; }

Property Value ​

Guid

Text ​

文本数据

csharp
string Text { get; }

Property Value ​

string

TextBytes ​

文本流数据包

csharp
Span<byte> TextBytes { get; }

Property Value ​

Span<byte>

Methods ​

ByteData<T>(in SendBytes<T>, int) ​

获取完整字节流

csharp
void ByteData<T>(in SendBytes<T> sendBytes, int textSize)

Parameters ​

sendBytes SendBytes<T>

textSize int

Type Parameters ​

T

Clone() ​

克隆完整副本

csharp
IDataPacket Clone()

Returns ​

IDataPacket

Exceptions ​

NotImplementedException

CopyTo(bool, bool) ​

拷贝当前数据

csharp
IDataPacket CopyTo(bool isbytes, bool istxet)

Parameters ​

isbytes bool

istxet bool

Returns ​

IDataPacket

GetAgentBytes<T>(T) ​

获取转发模式下专用数据对象

csharp
SendBytes<T> GetAgentBytes<T>(T client)

Parameters ​

client T

Returns ​

SendBytes<T>

Type Parameters ​

T

Exceptions ​

NotImplementedException

ResetValue(bool?, bool?, Ipv4Port?) ​

设置发送状态

csharp
void ResetValue(bool? IsSend = null, bool? IsServer = null, Ipv4Port? IpPort = null)

Parameters ​

IsSend bool?

IsServer bool?

IpPort Ipv4Port?

SetErr(string) ​

设置错误信息

csharp
void SetErr(string ex)

Parameters ​

ex string

TotalSize(out int) ​

获取包总大小

csharp
int TotalSize(out int textSize)

Parameters ​

textSize int

Returns ​

int

基于Apache-2.0协议开源