This commit is contained in:
高国正 2023-02-21 18:05:37 +08:00
parent b2845aff6b
commit e36b38efe1
19 changed files with 40 additions and 8 deletions

View File

@ -31,7 +31,7 @@ namespace UdpServerCMD
public static Socket udpServer;//udp服务器
public static bool memberReply;//是否回复消息
public static TypeFunctionCode LastType = TypeFunctionCode.;
//public static TypeFunctionCode LastType = TypeFunctionCode.默认;
public static int COMPort = 7000;//端口号
public static string IP1 = "172.16.1.49";//连接IP
@ -133,9 +133,10 @@ namespace UdpServerCMD
try
{
//var IP = "111.229.30.246";
var IP = "172.17.0.9";
//var IP = "172.16.1.49";
var Port = 12301;
//var IP = "172.17.0.9";
string IP = "172.16.1.49";
int Port = 12301;
//建立udp服务器参数2udp协议以数据报的方式传输参数3UDP协议
udpServer = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@ -452,7 +453,7 @@ namespace UdpServerCMD
chars.Add(data[i].ToString());
}
//byte[] _returnBytes = new byte[chars.Count];
byte[] returnBytes = new byte[chars.Count/2];
byte[] returnBytes = new byte[chars.Count / 2];
//逐个字符变为16进制字节数据
for (int i = 0; i < chars.Count; i++)
{
@ -460,7 +461,7 @@ namespace UdpServerCMD
{
if (i % 2 == 0)
{
returnBytes[i/2] = (byte)(Convert.ToByte(chars[i].ToString() + chars[i + 1].ToString(), 16));
returnBytes[i / 2] = (byte)(Convert.ToByte(chars[i].ToString() + chars[i + 1].ToString(), 16));
}
}
catch (Exception e)
@ -1539,6 +1540,7 @@ namespace UdpServerCMD
clockAnalysis(message, ipEnd);
break;
default:
Console.WriteLine("无此功能码: " + str);
break;
}
}
@ -1601,6 +1603,9 @@ namespace UdpServerCMD
Console.WriteLine("表型:" + s);
s.Clear().Append("84");
break;
default:
Console.WriteLine($"无此表型: {phenotype}");
break;
}
return s.ToString().Trim();
}
@ -1646,6 +1651,7 @@ namespace UdpServerCMD
Console.WriteLine("报警码:" + alarmCode);
break;
default:
Console.WriteLine($"无此报警码: {alarmCode}");
break;
}
}

View File

@ -0,0 +1,4 @@
------------------------------------------------
2023-02-21 17:55:27,859 [1] INFO loginfo - ½ÓÊÕ:40 3A 00 48 15 13 34 50 23 03 81 E0 3E E7 1E 83 3E D0 1F 31 8A 6B AE DD 42 65 D7 8C 96 B1 84 51 36 32 95 E8 D6 D8 CA 96 51 D4 3F 91 03 20 97 26 50 E7 4A C5 7F CF A2 12 74 7A F8 BA 15 2A AD B6 C0 6A 37 49 B2 E1 35 24 01 EB 85 9E 0D 0A
------------------------------------------------
2023-02-21 17:55:41,547 [1] INFO loginfo - ½ÓÊÕ:40 3A 00 48 15 13 34 50 23 03 81 E0 3E E7 1E 83 3E D0 1F 31 8A 6B AE DD 42 65 D7 8C 96 B1 84 51 36 32 95 E8 D6 D8 CA 96 51 D4 3F 91 03 20 97 26 50 E7 4A C5 7F CF A2 12 74 7A F8 BA 15 2A AD B6 C0 6A 37 49 B2 E1 35 24 01 EB 85 9E 0D 0A

View File

@ -1 +1 @@
f303633fc61bd04e4c3f7a497d9f456d27506847
5a19b734824e0e2fc92080fabad66652b743c3cb

View File

@ -9,3 +9,14 @@ D:\GaoGuoZheng_U3D\C#\UdpServerCMD\obj\Debug\UdpServerCMD.pdb
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\bin\Debug\log4net.dll
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\bin\Debug\log4net.xml
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\obj\Debug\UdpServerCMD.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Debug\UdpServerCMD.exe.config
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Debug\UdpServerCMD.exe
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Debug\UdpServerCMD.pdb
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Debug\log4net.dll
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Debug\log4net.xml
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.csproj.AssemblyReference.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.csproj.SuggestedBindingRedirects.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.csproj.CoreCompileInputs.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.exe
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Debug\UdpServerCMD.pdb

View File

@ -1 +1 @@
fe6e0c5922c5cf5954e01895b33fd933877075b4
d029687411ab201d571c29f5274ab02dc72104b0

View File

@ -9,3 +9,14 @@ D:\GaoGuoZheng_U3D\C#\UdpServerCMD\obj\Release\UdpServerCMD.pdb
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\bin\Release\log4net.dll
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\bin\Release\log4net.xml
D:\GaoGuoZheng_U3D\C#\UdpServerCMD\obj\Release\UdpServerCMD.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Release\UdpServerCMD.exe.config
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Release\UdpServerCMD.exe
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Release\UdpServerCMD.pdb
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Release\log4net.dll
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\bin\Release\log4net.xml
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.csproj.AssemblyReference.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.csproj.SuggestedBindingRedirects.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.csproj.CoreCompileInputs.cache
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.exe
D:\GaoGuoZheng_U3D\C#\ZHshuibiao\UdpServerCMD\obj\Release\UdpServerCMD.pdb