修改了截取IP的逻辑,更好的适配非192.168.1频段
This commit is contained in:
3
C-Windows-1/Form1.Designer.cs
generated
3
C-Windows-1/Form1.Designer.cs
generated
@@ -880,6 +880,7 @@
|
|||||||
this.progressBar1.Name = "progressBar1";
|
this.progressBar1.Name = "progressBar1";
|
||||||
this.progressBar1.Size = new System.Drawing.Size(100, 23);
|
this.progressBar1.Size = new System.Drawing.Size(100, 23);
|
||||||
this.progressBar1.TabIndex = 146;
|
this.progressBar1.TabIndex = 146;
|
||||||
|
this.progressBar1.Visible = false;
|
||||||
//
|
//
|
||||||
// button2
|
// button2
|
||||||
//
|
//
|
||||||
@@ -1637,7 +1638,7 @@
|
|||||||
this.Controls.Add(this.ReceiveText);
|
this.Controls.Add(this.ReceiveText);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
this.Text = "20240816";
|
this.Text = "20240819";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView1)).EndInit();
|
||||||
|
|||||||
@@ -1206,7 +1206,19 @@ namespace C_Windows_1
|
|||||||
byte[] data = Encoding.ASCII.GetBytes("hello,udp server");
|
byte[] data = Encoding.ASCII.GetBytes("hello,udp server");
|
||||||
System.Net.IPAddress ip;
|
System.Net.IPAddress ip;
|
||||||
string localip=GetLocalIPAddress();
|
string localip=GetLocalIPAddress();
|
||||||
localip = localip.Substring(0, 10) + "255";
|
|
||||||
|
// 查找第三个 '.' 符号的位置
|
||||||
|
int firstDot = localip.IndexOf('.');
|
||||||
|
int secondDot = localip.IndexOf('.', firstDot + 1);
|
||||||
|
int thirdDot = localip.IndexOf('.', secondDot + 1);
|
||||||
|
|
||||||
|
// 截取到第三个 '.' 符号
|
||||||
|
localip = thirdDot != -1
|
||||||
|
? localip.Substring(0, thirdDot + 1)
|
||||||
|
: localip;
|
||||||
|
|
||||||
|
localip = localip/*.Substring(0, 10)*/ + "255";
|
||||||
|
//Code.Text = localip;
|
||||||
ip = System.Net.IPAddress.Parse(localip);
|
ip = System.Net.IPAddress.Parse(localip);
|
||||||
// 获本机IP频段广播到 .255
|
// 获本机IP频段广播到 .255
|
||||||
IPEndPoint endPoint = new IPEndPoint(ip, Port);
|
IPEndPoint endPoint = new IPEndPoint(ip, Port);
|
||||||
@@ -3133,8 +3145,8 @@ namespace C_Windows_1
|
|||||||
station2 = Convert.ToUInt16(stationIP);
|
station2 = Convert.ToUInt16(stationIP);
|
||||||
station = station2.ToString("X2");
|
station = station2.ToString("X2");
|
||||||
Modbusread(360, 4, ReadData);
|
Modbusread(360, 4, ReadData);
|
||||||
labelruanjian.Text = "软件版本号:" + ReadData[360].ToString("X4") + ReadData[361].ToString("X4");
|
labelruanjian.Text = "软件版本号:" + ReadData[361].ToString("X4") + ReadData[360].ToString("X4");
|
||||||
labelyinjian.Text = "硬件版本号:" + ReadData[362].ToString("X4") + ReadData[363].ToString("X4");
|
labelyinjian.Text = "硬件版本号:" + ReadData[363].ToString("X4") + ReadData[362].ToString("X4");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
C-Windows-1/TestPara.Designer.cs
generated
2
C-Windows-1/TestPara.Designer.cs
generated
@@ -878,7 +878,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(712, 425);
|
this.ClientSize = new System.Drawing.Size(644, 425);
|
||||||
this.Controls.Add(this.label15);
|
this.Controls.Add(this.label15);
|
||||||
this.Controls.Add(this.label54);
|
this.Controls.Add(this.label54);
|
||||||
this.Controls.Add(this.TestTime2);
|
this.Controls.Add(this.TestTime2);
|
||||||
|
|||||||
@@ -91,13 +91,13 @@ namespace C_Windows_1
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (FullTime.Text == "" || BBalanTime.Text == "" || SBalanTime.Text == "" || TestTime1.Text == "" || ExhaustTime.Text == "" || BypassTime.Text == "" || DelayTime1.Text == "" || DelayTime2.Text == "" || BLeakLPre.Text == "" || BLeakTPre.Text == "" || LUnit.Text == "" || PUnit.Text == "")
|
if (FullTime.Text == "" || TestTime1.Text == "" || ExhaustTime.Text == "" || DelayTime1.Text == "" || DelayTime2.Text == "" || BLeakLPre.Text == "" || BLeakTPre.Text == "" || LUnit.Text == "" || PUnit.Text == "")
|
||||||
{
|
{
|
||||||
MessageBox.Show("输入参数格式不对");
|
MessageBox.Show("输入参数格式不对");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FullTime.Text == "" || BBalanTime.Text == "" || SBalanTime.Text == "" || TestTime1.Text == "" || ExhaustTime.Text == "" || BypassTime.Text == "" || DelayTime1.Text == "" || DelayTime2.Text == "" || BLeakLPre.Text == "" || BLeakTPre.Text == "" || LUnit.Text == "" || PUnit.Text == "")
|
if (FullTime.Text == "" || TestTime1.Text == "" || ExhaustTime.Text == "" || DelayTime1.Text == "" || DelayTime2.Text == "" || BLeakLPre.Text == "" || BLeakTPre.Text == "" || LUnit.Text == "" || PUnit.Text == "")
|
||||||
{
|
{
|
||||||
MessageBox.Show("输入参数格式不对");
|
MessageBox.Show("输入参数格式不对");
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
C-Windows-1/bin/LL-28上位机.zip
Normal file
BIN
C-Windows-1/bin/LL-28上位机.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user