Komunikation mit server erstellt
This commit is contained in:
Generated
+11
-5
@@ -30,7 +30,6 @@
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Netzmonitor));
|
||||
this.serviceController1 = new System.ServiceProcess.ServiceController();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -50,8 +49,7 @@
|
||||
this.trayMenuNetzwerk = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.trayMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
@@ -167,6 +165,15 @@
|
||||
this.trayIcon.Visible = true;
|
||||
this.trayIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseDoubleClick);
|
||||
//
|
||||
// trayMenu
|
||||
//
|
||||
this.trayMenu.Name = "trayMenu";
|
||||
//
|
||||
// trayMenuNetzwerk
|
||||
//
|
||||
this.trayMenuNetzwerk.Name = "trayMenuNetzwerk";
|
||||
this.trayMenuNetzwerk.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// Netzmonitor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -182,14 +189,13 @@
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.trayMenu.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private System.ServiceProcess.ServiceController serviceController1;
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace NetMonitorClient
|
||||
{
|
||||
InitializeComponent();
|
||||
InitNetworks();
|
||||
this.serviceController1.ServiceName = "NetMonitorServer";
|
||||
this.sc = new ServiceControl(this.serviceController1);
|
||||
this.sc = new ServiceControl("NetMonitorServer");
|
||||
}
|
||||
|
||||
private void trayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
|
||||
@@ -2,20 +2,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ServiceProcess;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
|
||||
namespace NetMonitorClient
|
||||
{
|
||||
class ServiceControl
|
||||
{
|
||||
private System.ServiceProcess.ServiceController sc;
|
||||
public ServiceControl(System.ServiceProcess.ServiceController Controller)
|
||||
private UdpClient client;
|
||||
private IPEndPoint rep; //remoteEndPoint
|
||||
public ServiceControl(string name)
|
||||
{
|
||||
this.sc = Controller;
|
||||
ServiceController sc = new ServiceController();
|
||||
sc.ServiceName = name;
|
||||
//if (sc.Status != ServiceControllerStatus.Running)
|
||||
//{
|
||||
// sc.Start();
|
||||
//}
|
||||
this.client = new UdpClient();
|
||||
this.rep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 34523);
|
||||
}
|
||||
|
||||
internal void setNetworkAuto()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
byte[] data = Encoding.UTF8.GetBytes("NET AUTO");
|
||||
this.client.Send(data, data.Length, this.rep);
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal void setNetworkIp(string ip, string subnet, string gateway)
|
||||
|
||||
Reference in New Issue
Block a user