This commit is contained in:
lxd 2025-01-08 17:49:36 +08:00
commit 30d083e1ab

View File

@ -3026,12 +3026,8 @@ namespace FlyDockTool
IPAddress ipAddress = IPAddress.Parse(tcp_ip);
// IPAddress ipAddress = IPAddress.Any;
//// 创建一个监听Socket
if (listener == null)
{
listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port)));
listener.Listen(10000);
}
clientSocket = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
clientSocket.Connect(ipAddress, int.Parse(tcp_port));
_tcpResult.Change(0, 10);//开始tcp数据接收10毫秒频率
}
@ -3261,7 +3257,16 @@ namespace FlyDockTool
}
if (apiOptions.CurrentDevice == "BC-5120")//BC-5120
{
_tResult.Change(5000, 5000);// 数据处理延迟5秒开始 5秒计时
if (tempData.Contains(@"OBR|1||Background|"))
{
tempData = string.Empty;
}
else
{
string tempData_temp = tempData;
tempData = string.Empty;
deviceAnalysisOption(tempData_temp);
}
}
if (apiOptions.CurrentDevice == "BS-460")//生化BS-460
{
@ -3324,7 +3329,9 @@ namespace FlyDockTool
void tcpResultTick()
{
byte[] data = new byte[40048];
if (apiOptions.CurrentDevice != "BC-5130")//如果设备是 apiOptions.CurrentDevice=== "BC-5130" 这个设备在 启动时就已经主动连上了 "BC-5130" 设备,这里就无需初始化连接 直接跳过
//如果设备是BC-5130这类的则表示这个设备在启动时就已经主动连上了。BC-5130设备这里就无需初始化连接直接跳过
List<string> ConnectDevices = new List<string>(new string[] { "BC-5130", "BC-5120" });
if (!ConnectDevices.Contains(apiOptions.CurrentDevice))
{
if (clientSocket == null)
clientSocket = listener.Accept(); //一旦接受连接,创建一个客户端