public Test() { Client client = new Client(); client.StartListeningOnSeperateThread(10); lobbyAddress = "127.0.0.1"; lobbyPort = "9999"; lobbySharedDictionary = new SimpleSharedDictionary( client.OpenBinaryChannel(lobbyAddress, lobbyPort, 0)); ourAddress = "127.0.0.1"; ourPort = "9997"; Console.Write("My name: "); ourName = Prompt.Show("What is the name of the server?"); if (ourName == null) return; Console.WriteLine("Lobby started."); LobbyServer ls = new LobbyServer(ourName, ourAddress, ourPort, lobbySharedDictionary); Console.ReadKey(); Console.WriteLine("Now in Progress."); ls.InProgress = true; Console.ReadKey(); }
public frmSharedDictionaryTestForm() { InitializeComponent(); c = new Client(); sd = new SimpleSharedDictionary(c.OpenBinaryChannel("127.0.0.1", "9999", 0)); sd.ChangeEvent += new SimpleSharedDictionary.Change(sd_ChangeEvent); }
public LobbyServer(string name, string address, string port, SimpleSharedDictionary sharedDictionary) { myKey = address + ":" + port + ":" + name; this.sharedDictionary = sharedDictionary; this.server = new ServerInfo(); this.server.Name = name; this.server.IPAddress = address; this.server.Port = port; this.server.Participants = new List<string>(); this.server.InProgress = false; sharedDictionary.Master.Add(myKey); sharedDictionary[myKey] = server; sharedDictionary.Changed += new SimpleSharedDictionary.Change(ChangeEvent); }