private void button1_Click(object sender, EventArgs e) { NetPeerConfiguration config = new NetPeerConfiguration("MMC"); config.MaximumConnections = 100; config.Port = 3939; // Enable DiscoveryResponse messages config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); MMCPeerConfig pConfig = new MMCPeerConfig(config, PeerType.CONTROLLER, "Controller1"); s_server = new MMCPeer(pConfig); s_server.RegisterCallback(new Action<MMCMessage>(GotMessage)); Output("listening on " + config.Port.ToString()); s_server.Start(); }
private void button1_Click(object sender, EventArgs e) { NetPeerConfiguration config = new NetPeerConfiguration("MMC"); config.MaximumConnections = 100; config.Port = (int)numericUpDown1.Value; // Enable DiscoveryResponse messages config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); config.AcceptIncomingConnections = true; MMCPeerConfig pConfig = new MMCPeerConfig(config, (PeerType)comboBox1.SelectedIndex, textBox1.Text); s_server = new MMCPeer(pConfig); Output("listening on " + config.Port.ToString()); s_server.RegisterCallback(new Action<MMCMessage>(GotMessage)); s_server.Start(); }
public MMCPeer(MMCPeerConfig config) : base(config.npConfig) { DiscoveredClients = new HashSet<ClientValue>(); ConnectedClients = new List<KeyValuePair<ClientValue, NetConnection>>(); pConfig = config; RegisterReceivedCallback(new SendOrPostCallback(MessageCallback)); }