Fantasy
搜索结果

    显示/隐藏目录

    NetworkHelper 类

    提供网络操作相关的帮助方法。

    继承
    object
    NetworkHelper
    继承成员
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    命名空间: Fantasy.Helper
    程序集: Fantasy.Net.dll
    语法
    public static class NetworkHelper

    方法

    | 编辑本文 查看源代码

    ByteToSocketAddress(byte[], int, out SocketAddress)

    将byre[]转换为SocketAddress

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static int ByteToSocketAddress(byte[] buffer, int offset, out SocketAddress socketAddress)
    参数
    类型 名称 描述
    byte[] buffer
    int offset
    SocketAddress socketAddress
    返回
    类型 描述
    int
    异常
    类型 条件
    ArgumentNullException
    ArgumentException
    InvalidOperationException
    | 编辑本文 查看源代码

    ByteToSocketAddress(ReadOnlyMemory<byte>, int, out SocketAddress)

    将ReadOnlyMemory转换为SocketAddress

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static int ByteToSocketAddress(ReadOnlyMemory<byte> buffer, int offset, out SocketAddress socketAddress)
    参数
    类型 名称 描述
    ReadOnlyMemory<byte> buffer
    int offset
    SocketAddress socketAddress
    返回
    类型 描述
    int
    异常
    类型 条件
    ArgumentException
    InvalidOperationException
    | 编辑本文 查看源代码

    Clone(EndPoint)

    克隆一个IPEndPoint

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static IPEndPoint Clone(this EndPoint endPoint)
    参数
    类型 名称 描述
    EndPoint endPoint
    返回
    类型 描述
    IPEndPoint
    | 编辑本文 查看源代码

    GetAddressIPs()

    获取本机所有网络适配器的IP地址。

    声明
    public static string[] GetAddressIPs()
    返回
    类型 描述
    string[]

    IP地址数组。

    | 编辑本文 查看源代码

    GetIPEndPoint(SocketAddress)

    根据SocketAddress获得IPEndPoint

    声明
    public static IPEndPoint GetIPEndPoint(this SocketAddress socketAddress)
    参数
    类型 名称 描述
    SocketAddress socketAddress
    返回
    类型 描述
    IPEndPoint
    异常
    类型 条件
    NotSupportedException
    | 编辑本文 查看源代码

    GetIPEndPoint(string)

    根据字符串获取一个IPEndPoint

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static IPEndPoint GetIPEndPoint(string address)
    参数
    类型 名称 描述
    string address
    返回
    类型 描述
    IPEndPoint
    | 编辑本文 查看源代码

    IPEndPointEquals(EndPoint, IPEndPoint)

    比较两个IPEndPoint是否相等

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool IPEndPointEquals(this EndPoint endPoint, IPEndPoint ipEndPoint)
    参数
    类型 名称 描述
    EndPoint endPoint
    IPEndPoint ipEndPoint
    返回
    类型 描述
    bool
    | 编辑本文 查看源代码

    IPEndPointEquals(IPEndPoint, IPEndPoint)

    比较两个IPEndPoint是否相等

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool IPEndPointEquals(this IPEndPoint endPoint, IPEndPoint ipEndPoint)
    参数
    类型 名称 描述
    IPEndPoint endPoint
    IPEndPoint ipEndPoint
    返回
    类型 描述
    bool
    | 编辑本文 查看源代码

    IPEndPointToStr(IPEndPoint)

    将 IPEndPoint 实例转换为字符串表示形式。

    声明
    public static string IPEndPointToStr(this IPEndPoint self)
    参数
    类型 名称 描述
    IPEndPoint self

    IPEndPoint 实例。

    返回
    类型 描述
    string

    表示 IPEndPoint 的字符串。

    | 编辑本文 查看源代码

    SetReceiveBufferToOSLimit(Socket, int, int)

    将 Socket 接收缓冲区大小设置为操作系统限制。 尝试增加接收缓冲区大小的次数 = 默认 + 最大增加 100 MB。

    声明
    public static void SetReceiveBufferToOSLimit(this Socket socket, int stepSize = 1024, int attempts = 100000)
    参数
    类型 名称 描述
    Socket socket

    要设置接收缓冲区大小的 Socket。

    int stepSize

    每次增加的步长大小。

    int attempts

    尝试增加缓冲区大小的次数。

    | 编辑本文 查看源代码

    SetSendBufferToOSLimit(Socket, int, int)

    将 Socket 发送缓冲区大小设置为操作系统限制。 尝试增加发送缓冲区大小的次数 = 默认 + 最大增加 100 MB。

    声明
    public static void SetSendBufferToOSLimit(this Socket socket, int stepSize = 1024, int attempts = 100000)
    参数
    类型 名称 描述
    Socket socket

    要设置发送缓冲区大小的 Socket。

    int stepSize

    每次增加的步长大小。

    int attempts

    尝试增加缓冲区大小的次数。

    | 编辑本文 查看源代码

    SetSioUdpConnReset(Socket)

    针对 Windows 平台设置UDP连接重置选项。

    声明
    public static void SetSioUdpConnReset(this Socket socket)
    参数
    类型 名称 描述
    Socket socket

    要设置选项的 Socket 实例。

    | 编辑本文 查看源代码

    SetSocketBufferToOsLimit(Socket)

    将 Socket 缓冲区大小设置为操作系统限制。

    声明
    public static void SetSocketBufferToOsLimit(this Socket socket)
    参数
    类型 名称 描述
    Socket socket

    要设置缓冲区大小的 Socket。

    | 编辑本文 查看源代码

    SocketAddressToByte(SocketAddress, byte[], int)

    将SocketAddress写入到Byte[]中

    声明
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void SocketAddressToByte(this SocketAddress socketAddress, byte[] buffer, int offset)
    参数
    类型 名称 描述
    SocketAddress socketAddress
    byte[] buffer
    int offset
    | 编辑本文 查看源代码

    ToIPEndPoint(string)

    将地址字符串转换为 IPEndPoint 实例。

    声明
    public static IPEndPoint ToIPEndPoint(string address)
    参数
    类型 名称 描述
    string address

    地址字符串,格式为 "主机名:端口号"。

    返回
    类型 描述
    IPEndPoint

    IPEndPoint 实例。

    | 编辑本文 查看源代码

    ToIPEndPoint(string, int)

    将主机名和端口号转换为 IPEndPoint 实例。

    声明
    public static IPEndPoint ToIPEndPoint(string host, int port)
    参数
    类型 名称 描述
    string host

    主机名。

    int port

    端口号。

    返回
    类型 描述
    IPEndPoint

    IPEndPoint 实例。

    • 编辑本文
    • 查看源代码
    本文内容
    Back to top Generated by DocFX