Ejemplo n.º 1
0
 // -- Netzwerk starten --
 private void buttonNetServer_Click(object sender, EventArgs e)
 {
     srv = new Server();
     srv.UpdateText += UpdateLabelText; // Ereignis abonnieren
     if (radioButtonNetTCP.Checked)
     {
         if (checkBoxIPv6.Checked) srv.connect("v6", numericUpDownNetPort.Value.ToString());
         else srv.connect("v4", numericUpDownNetPort.Value.ToString());
         numericUpDownKISpeed.Value = 500;
         numericUpDownKISpeed.Minimum = 500;
     }
     else
     {
         if (checkBoxIPv6.Checked) srv.connect("udpv6", numericUpDownNetPort.Value.ToString());
         else srv.connect("udp", numericUpDownNetPort.Value.ToString());
     }
     txtbx("Server Online");
     labelNetStatus.Text = "Sie sind verbunden!";
     MessageBox.Show("Der Server wurde erfolgreich geöffnet!",
                     "Über Mensch Ärgere Dich nicht", MessageBoxButtons.OK, MessageBoxIcon.Information);
     buttonCommand.Enabled = false;
     groupBoxNetwork.Enabled = false;
     srv.online();
     buttonDebug.Visible = true;
     buttonDebug.Text = "Server beenden";
     groupBoxNetwork.Size = new Size(206, 115);
     textBoxNetIP.Text = Server.GetLocalAddresses("")[0];
 }
Ejemplo n.º 2
0
 // netzwerk scannen (broadcast)
 private void buttonNetScan_Click(object sender, EventArgs e)
 {
     byte[] byteBuffer = System.Text.Encoding.ASCII.GetBytes("hello Server");
     if (broadcast == null)
     {
         broadcast = new Server();
         if (checkBoxIPv6.Checked) broadcast.connect("udpv6", "7");
         else broadcast.connect("udp", "7");
         broadcast.UpdateText += broadcastincomming; // Ereignis abonnieren
     }
     listBoxNetServer.Items.Clear();
     broadcast.BroadCastSend(byteBuffer, 7);
 }