Komunikation mit dem cliend
This commit is contained in:
parent
e5071d044c
commit
afcd1b62d6
@ -34,8 +34,12 @@ namespace NetMonitorClient
|
||||
String wins = networkini.getValue(Item.Name, "Wins");
|
||||
String adapter = networkini.getValue(Item.Name, "Adapter");
|
||||
|
||||
if (ip == "auto" && dns == "auto" && wins == "auto")
|
||||
this.sc.setNetworkAuto(adapter);
|
||||
String ret = "";
|
||||
if (ip == "auto" && dns == "auto" && wins == "auto")
|
||||
{
|
||||
if (this.sc.setNetworkAuto(adapter))
|
||||
ret = Item.Name+";Netzwerk auf Auto gesetzt";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ip == "auto")
|
||||
@ -51,7 +55,9 @@ namespace NetMonitorClient
|
||||
else
|
||||
this.sc.setNetworkWINS(wins, adapter);
|
||||
}
|
||||
|
||||
this.trayIcon.BalloonTipIcon = ToolTipIcon.Info;
|
||||
this.trayIcon.BalloonTipTitle = ret.Split(';')[0];
|
||||
this.trayIcon.BalloonTipText = ret.Split(';')[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ namespace NetMonitorClient
|
||||
{
|
||||
private UdpClient client;
|
||||
private IPEndPoint rep; //remoteEndPoint
|
||||
private UdpClient answ = new UdpClient(34524);
|
||||
private IPEndPoint iep = new IPEndPoint(IPAddress.Loopback, 0);
|
||||
public ServiceControl(string name)
|
||||
{
|
||||
ServiceController sc = new ServiceController();
|
||||
@ -33,6 +35,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET AUTO "+adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
internal bool setNetworkIp(string ip, string subnet, string gateway, string adapter)
|
||||
@ -59,6 +62,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET IP " + ip + " " + subnet + " " + gateway + " " + adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
internal bool setNetworkDNS(string dns, string adapter)
|
||||
@ -75,6 +79,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET DNS " + dns + " " + adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
internal bool setNetworkWINS(string wins, string adapter)
|
||||
@ -91,6 +96,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET WINS " + wins + " " + adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
internal bool setNetworkIpAuto(string adapter)
|
||||
@ -102,6 +108,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET IP AUTO "+adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +121,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET DNS AUTO " + adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
|
||||
internal bool setNetworkWinsAuto(string adapter)
|
||||
@ -125,6 +133,7 @@ namespace NetMonitorClient
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET WINS AUTO " + adapter);
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
return Boolean.Parse(Encoding.UTF8.GetString(client.Receive(ref iep)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user