Skip to content

Class UdpEndPoint

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

Udp通信专属模块

csharp
public class UdpEndPoint : EndPoint

Inheritance

objectEndPointUdpEndPoint

Inherited Members

EndPoint.Create(SocketAddress), EndPoint.Serialize(), EndPoint.AddressFamily, 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

UdpEndPoint(IPAddress, ushort)

创建一个Udp通信IP地址

csharp
public UdpEndPoint(IPAddress address, ushort port)

Parameters

address IPAddress

port ushort

Properties

Address

IP地址信息

csharp
public IPAddress Address { get; }

Property Value

IPAddress

AddressFamily

IP地址类型

csharp
public override AddressFamily AddressFamily { get; }

Property Value

AddressFamily

Ipv4

获取IpV4地址信息

csharp
public Ipv4Port Ipv4 { get; }

Property Value

Ipv4Port

Port

通信端口

csharp
public ushort Port { get; }

Property Value

ushort

Methods

Create(SocketAddress)

根据数据获取

csharp
public override EndPoint Create(SocketAddress socketAddress)

Parameters

socketAddress SocketAddress

Returns

EndPoint

Exceptions

Exception

Equals(object)

判断是否一致

csharp
public override bool Equals(object obj)

Parameters

obj object

比较值

Returns

bool

是或否

Equals(UdpEndPoint)

判断是否一致

csharp
public bool Equals(UdpEndPoint other)

Parameters

other UdpEndPoint

比较值

Returns

bool

是或否

GetHashCode()

获取哈希值

csharp
public override int GetHashCode()

Returns

int

Serialize()

获取

csharp
public override SocketAddress Serialize()

Returns

SocketAddress

ToString()

默认信息

csharp
public override string ToString()

Returns

string

TryParse(string, int, out UdpEndPoint)

尝试判断是否可用的IP端口信息

csharp
public static bool TryParse(string ip, int port, out UdpEndPoint point)

Parameters

ip string

IP信息

port int

端口信息

point UdpEndPoint

返回的可用对象

Returns

bool

是否成功

Exceptions

Exception

失败的信息

Operators

operator ==(UdpEndPoint, UdpEndPoint)

指示两个 结构是否相等。

csharp
public static bool operator ==(UdpEndPoint a, UdpEndPoint b)

Parameters

a UdpEndPoint

相等运算符左侧的结构

b UdpEndPoint

相等运算符右侧的结构

Returns

bool

如果 true 等于 a,则为 b;否则为 false。

operator !=(UdpEndPoint, UdpEndPoint)

指示两个 结构是否不相等。

csharp
public static bool operator !=(UdpEndPoint a, UdpEndPoint b)

Parameters

a UdpEndPoint

不等运算符左侧的结构

b UdpEndPoint

不等运算符右侧的结构

Returns

bool

如果 true 不等于 a,则为 b;否则为 false。

基于Apache-2.0协议开源