diff --git a/CRICS_V3_1124.sln b/CRICS_V3_1124.sln index 049da82..79b4e51 100644 --- a/CRICS_V3_1124.sln +++ b/CRICS_V3_1124.sln @@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testwebservice", "testwebse EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcApplication1", "MvcApplication1\MvcApplication1.csproj", "{733CA292-F36D-4DC7-8268-3337C5D1B540}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication4", "ConsoleApplication4\ConsoleApplication4.csproj", "{85BC55B1-083D-4AE9-8DE8-3DE59B654990}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -191,6 +193,16 @@ Global {733CA292-F36D-4DC7-8268-3337C5D1B540}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {733CA292-F36D-4DC7-8268-3337C5D1B540}.Release|Mixed Platforms.Build.0 = Release|Any CPU {733CA292-F36D-4DC7-8268-3337C5D1B540}.Release|x86.ActiveCfg = Release|Any CPU + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Debug|Any CPU.ActiveCfg = Debug|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Debug|x86.ActiveCfg = Debug|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Debug|x86.Build.0 = Debug|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|Any CPU.ActiveCfg = Release|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|Mixed Platforms.Build.0 = Release|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|x86.ActiveCfg = Release|x86 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo index 5dd1836..1a784d9 100644 Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ diff --git a/Common/CSRedisCacheHelper.cs b/Common/CSRedisCacheHelper.cs index 81656c9..2f4349a 100644 --- a/Common/CSRedisCacheHelper.cs +++ b/Common/CSRedisCacheHelper.cs @@ -324,7 +324,7 @@ namespace Common CSRedisClient client = WhitchRedisSlice(SliceNo); client.LPush(key, obj); } - public static int MaxLen = 800000; + public static long MaxLen = 1000000; public static void StreamAdd(int SliceNo, string key, string Value) { try @@ -333,9 +333,9 @@ namespace Common // 添加简单消息 client.XAdd(key, MaxLen, "*", new ValueTuple("__data", Value)); } - catch (Exception) + catch (Exception ex) { - + logger.Error("队列添加出异常了:"+ex.Message); } } public static void StreamConsume(int SliceNo, string key, string group = "UDPData", string consumer = "Crics1") diff --git a/CommonEntity/LMRegisterInfo.cs b/CommonEntity/LMRegisterInfo.cs index 5d0212f..0ce822e 100644 --- a/CommonEntity/LMRegisterInfo.cs +++ b/CommonEntity/LMRegisterInfo.cs @@ -23,4 +23,48 @@ namespace CommonEntity //public string Gateway { get; set; } //public string DNS { get; set; } } + public class RegisterInfo + { + public long hotel_id { get; set; } + public string room_id { get; set; } + public string device_id { get; set; } + + + /// + /// 1:下发,0:上报 默认0 + /// + public ushort is_send { get; set; } + public byte[] udp_raw { get; set; } + public string extra { get; set; } + + public int ip_type { get; set; } + /// + /// 机型编号 + /// + public string model_num { get; set; } + public string server_ip { get; set; } + public string ip { get; set; } + public string subnet_mask { get; set; } + public string gateway { get; set; } + public string dns { get; set; } + public string version { get; set; } + public string rcu_time { get; set; } + public string launcher_version { get; set; } + public string mac { get; set; } + public string room_type_id { get; set; } + public string config_version { get; set; } + public string room_status { get; set; } + public string season { get; set; } + public string sys_lock_status { get; set; } + public string authorization_time { get; set; } + public string authorization_days { get; set; } + public string room_num_remark { get; set; } + public string room_type_remark { get; set; } + public string room_remark { get; set; } + + public string mcu_name { get; set; } + public string central_control_name { get; set; } + public string configure_hotel_name { get; set; } + public string configure_room_type_name { get; set; } + } } diff --git a/ConsoleApplication2/Program.cs b/ConsoleApplication2/Program.cs index aa30911..3fdfb6a 100644 --- a/ConsoleApplication2/Program.cs +++ b/ConsoleApplication2/Program.cs @@ -299,6 +299,9 @@ namespace ConsoleApplication2 } } } + + + static void Main(string[] args) { byte[] ss111= Base64Url.Decode("qlUuAFQzU0E01oL4CIZhAQIABgAgAAAAAAAA/wICBwEAAAIbKgcCAAACGyp4Ig=="); diff --git a/ConsoleApplication4/ConsoleApplication4.csproj b/ConsoleApplication4/ConsoleApplication4.csproj new file mode 100644 index 0000000..728f8ce --- /dev/null +++ b/ConsoleApplication4/ConsoleApplication4.csproj @@ -0,0 +1,57 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {85BC55B1-083D-4AE9-8DE8-3DE59B654990} + Exe + Properties + ConsoleApplication4 + ConsoleApplication4 + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ConsoleApplication4/Program.cs b/ConsoleApplication4/Program.cs new file mode 100644 index 0000000..eca8855 --- /dev/null +++ b/ConsoleApplication4/Program.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net.Sockets; +using System.Net; + +namespace ConsoleApplication4 +{ + internal class UdpState + { + private UdpClient udpClient; + public UdpState(UdpClient client) + { + this.udpClient = client; + } + public UdpClient UdpClient + { + get { return this.udpClient; } + } + } + class Program + { + static void Main(string[] args) + { + var udpClient = new UdpClient(3340); + udpClient.Client.ReceiveBufferSize = 3 * 1024 * 1024; + udpClient.BeginReceive(ReceiveCallback, new UdpState(udpClient)); + Console.ReadLine(); + } + + public static void ReceiveCallback(IAsyncResult ar) + { + UdpState state = ar.AsyncState as UdpState; + // 1. 结束异步接收,获取数据和远程端点 + IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); + byte[] receivedData = state.UdpClient.EndReceive(ar, ref remoteEndPoint); + + state.UdpClient.BeginReceive(ReceiveCallback, state); + try + { + Console.WriteLine(11111111111111); + } + catch (Exception) + { + + } + } + } +} diff --git a/ConsoleApplication4/Properties/AssemblyInfo.cs b/ConsoleApplication4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8f4d222 --- /dev/null +++ b/ConsoleApplication4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("ConsoleApplication4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApplication4")] +[assembly: AssemblyCopyright("Copyright © 2026")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("3ac386f6-d433-4860-9b22-ee7e0dc298d4")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 内部版本号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ConsoleApplication4/bin/Debug/ConsoleApplication4.exe b/ConsoleApplication4/bin/Debug/ConsoleApplication4.exe new file mode 100644 index 0000000..b58d4e9 Binary files /dev/null and b/ConsoleApplication4/bin/Debug/ConsoleApplication4.exe differ diff --git a/ConsoleApplication4/bin/Debug/ConsoleApplication4.pdb b/ConsoleApplication4/bin/Debug/ConsoleApplication4.pdb new file mode 100644 index 0000000..0cb6831 Binary files /dev/null and b/ConsoleApplication4/bin/Debug/ConsoleApplication4.pdb differ diff --git a/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe b/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe new file mode 100644 index 0000000..bb84a51 Binary files /dev/null and b/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe differ diff --git a/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe.manifest b/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/ConsoleApplication4/bin/Debug/ConsoleApplication4.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.csproj.FileListAbsolute.txt b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..9f50ac6 --- /dev/null +++ b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.csproj.FileListAbsolute.txt @@ -0,0 +1,4 @@ +E:\tian\chongxin\NewGit\CRICS\CRICS_Web_Server_VS2010_Prod\ConsoleApplication4\bin\Debug\ConsoleApplication4.exe +E:\tian\chongxin\NewGit\CRICS\CRICS_Web_Server_VS2010_Prod\ConsoleApplication4\bin\Debug\ConsoleApplication4.pdb +E:\tian\chongxin\NewGit\CRICS\CRICS_Web_Server_VS2010_Prod\ConsoleApplication4\obj\x86\Debug\ConsoleApplication4.exe +E:\tian\chongxin\NewGit\CRICS\CRICS_Web_Server_VS2010_Prod\ConsoleApplication4\obj\x86\Debug\ConsoleApplication4.pdb diff --git a/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.exe b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.exe new file mode 100644 index 0000000..b58d4e9 Binary files /dev/null and b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.exe differ diff --git a/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.pdb b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.pdb new file mode 100644 index 0000000..0cb6831 Binary files /dev/null and b/ConsoleApplication4/obj/x86/Debug/ConsoleApplication4.pdb differ diff --git a/ConsoleApplication4/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ConsoleApplication4/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..4a522a0 Binary files /dev/null and b/ConsoleApplication4/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/RCUHost/Implement/HostRegisterReceiver.cs b/RCUHost/Implement/HostRegisterReceiver.cs index 9af0f20..7d8c166 100644 --- a/RCUHost/Implement/HostRegisterReceiver.cs +++ b/RCUHost/Implement/HostRegisterReceiver.cs @@ -261,6 +261,24 @@ namespace RCUHost.Implement hostRCU.RoomTypeRemark = roomtype_remark; hostRCU.UpdateTime = DateTime.Now; + RegisterInfo rsg = new RegisterInfo() + { + hotel_id=hotel_code, + room_id=host.RoomNumber, + device_id = HostNumberOnly, + is_send=0, + udp_raw=context.Data, + ip_type=ipType, + model_num = type_number, + server_ip=server_ip, + ip=lan_ip+":"+lan_port, + subnet_mask=subnet_mask, + gateway=gateway, + dns=dns, + version = software_version, + + }; + HostRepository.SetModelAndLauncher(host, hostRCU.ConfigVersion, software_version, lan_ip, lan_port, model, launcher_version, hostRCU.ExpireTime, hostRCU.SetExpireTime); HostRCURepository.SaveOrUpdate(hostRCU); diff --git a/RCUHost/Implement/HostServer.cs b/RCUHost/Implement/HostServer.cs index f1c0d3e..3e0879d 100644 --- a/RCUHost/Implement/HostServer.cs +++ b/RCUHost/Implement/HostServer.cs @@ -123,7 +123,7 @@ namespace RCUHost.Implement try { var redis = CSRedisCacheHelper.redis1; - var data = redis.XReadGroup(group, consumer, 1000, 10, new ValueTuple(UDPAllDataKey, ">")); + var data = redis.XReadGroup(group, consumer, 500, 10, new ValueTuple(UDPAllDataKey, ">")); if (data != null) { @@ -147,7 +147,7 @@ namespace RCUHost.Implement } catch (Exception ex) { - logger.Error("消息队列失败:"+ex.Message); + logger.Error("消息队列失败:" + ex.Message); } } @@ -169,7 +169,7 @@ namespace RCUHost.Implement try { udpClient = new UdpClient(3339); - udpClient.Client.ReceiveBufferSize = 5 * 1024 * 1024; + udpClient.Client.ReceiveBufferSize = 3 * 1024 * 1024; uint IOC_IN = 0x80000000; uint IOC_VENDOR = 0x18000000; uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; @@ -459,6 +459,8 @@ namespace RCUHost.Implement { IPEndPoint remoteEP111 = new IPEndPoint(IPAddress.Any, 0); byte[] receiveBuffer111 = state.UdpClient.EndReceive(ar, ref remoteEP111); + state.UdpClient.BeginReceive(ReceiveCallback, state); + if (receiveBuffer111.Length > 0) { @@ -719,17 +721,17 @@ namespace RCUHost.Implement } finally { - try - { - if (this.udpClient != null) - { - state.UdpClient.BeginReceive(ReceiveCallback, new UdpState(this.udpClient)); - } - } - catch - { + //try + //{ + // if (this.udpClient != null) + // { + // state.UdpClient.BeginReceive(ReceiveCallback, new UdpState(this.udpClient)); + // } + //} + //catch + //{ - } + //} } } @@ -1628,7 +1630,7 @@ namespace RCUHost.Implement #region 故意让UDP丢掉的数据包总数 //insertcard 保留 //if (cmdType != 0x0E||cmdType!=0x01) - if (cmdType != 0E || cmdType != 0x03) + if (cmdType != 0E && cmdType != 0x03) { if (DataTongJi.DefineLostPackage != 0) {