Class WebStateObject
Namespace: Tool.Sockets.Kernels
Assembly: Tool.Net.dll
对异步接收时的对象状态的封装,将Websocket与接收到的数据封装在一起
public class WebStateObject : StateObjectInheritance
object ← StateObject ← WebStateObject
Inherited Members
StateObject.EmptyIpv4Port, StateObject.HeadSize, StateObject.KeepAliveObj, StateObject.CreateSocket(bool, NetBufferSize), StateObject.SocketIsDispose(Socket), StateObject.HashCodeByte(in Memory<byte>), StateObject.QueueUserWorkItem<T>(ReceiveEvent<T>, ReceiveBytes<T>), StateObject.ReceivedAsync<T>(ReceiveEvent<T>, ReceiveBytes<T>), StateObject.GetIpPort(HttpListenerContext), StateObject.GetIpPort(Socket), StateObject.GetIpPort(EndPoint), StateObject.IsIpPort(string, out Ipv4Port), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
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)
Remarks
代码由逆血提供支持
Constructors
WebStateObject(WebSocketContext, int)
服务商构造
public WebStateObject(WebSocketContext context, int DataLength)Parameters
context WebSocketContext
对象
DataLength int
包的大小
WebStateObject(in UserKey, WebSocket, int)
连接者构造
public WebStateObject(in UserKey SocketKey, WebSocket Client, int DataLength)Parameters
SocketKey UserKey
连接标识
Client WebSocket
对象
DataLength int
包的大小
Properties
Client
为 WebSocket 网络服务提供客户端连接。
public WebSocket Client { get; }Property Value
ListData
接收的数据
public Memory<byte> ListData { get; }Property Value
SocketKey
当前对象唯一的连接票据
public UserKey SocketKey { get; }Property Value
State
返回 WebSocket 连接的当前状态。
public WebSocketState State { get; }Property Value
Remarks
WebSocket 连接的当前状态。
WebSocketContext
握手后的重要数据
public WebSocketContext WebSocketContext { get; }Property Value
Methods
AbortAsync()
关闭当前用户连接以及数据
public Task AbortAsync()Returns
Close()
回收对象所以资源
public void Close()IsConnected(WebSocket)
根据WebContext获取当前连接是否已经断开
public static bool IsConnected(WebSocket Client)Parameters
Client WebSocket
Returns
IsWebIpEffective(string)
返回可用的IP信息
public static Task<string> IsWebIpEffective(string ip)Parameters
ip string