202303241701Change

This commit is contained in:
17860779768
2023-03-24 17:02:04 +08:00
parent 03e8e92c40
commit d12b1b5f2d
19 changed files with 592 additions and 55 deletions

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace XKRS.Common.Model.Authority
{
public static class AuthorityCheck
{
public static Timer AuthorityCheckTimer = null;
public static UdpClient RemoteCheckClient = null;//提供用户数据报协议Udp网络服务
static byte[] CHECKBUFFER = null;
static IPEndPoint AuthorityServer = null;//将网络终结点表示为IP地址和端口号
public static bool IsAuthorityOK { get; set; } = false;//是否批准静态属性 默认初值为false
static bool _isCheckAuthorityNecessary = true;
static AuthorityCheck()
{
//AuthorityCheckTimer = new Timer(OnAuthorityCheck, null, 0, 1000 * 60);
RemoteCheckClient = new UdpClient();
//获取或设置 System.Boolean 值,该值指定是否 System.Net.Sockets.UdpClient 可能会发送或接收广播的数据包。
RemoteCheckClient.EnableBroadcast = true;
//获取或设置一个值,指定的后的时间量同步 Overload:System.Net.Sockets.Socket.Receive 调用将会超时。
RemoteCheckClient.Client.ReceiveTimeout = 1000;
CHECKBUFFER = Encoding.UTF8.GetBytes("AuthorityCheck");
//string checkStr = ConfigurationManger.AppSettings["AuthorityCheck"];
}
private static void OnAuthorityCheck(object state)
{
AuthorityCheckOperation();
}
public static void AuthorityCheckOperartion()
{
if (!_isCheckAuthorityNecessary)
{
IsAuthorityOK = true;
}
else
{
DogFeature feature = new DogFeature();
}
}
}
}