public void Execute() { if (Interlocked.CompareExchange(ref _hostThreadRunning, 1, 0) == 0) { HostThread.Start(); } }
public HostScreen(String ipstring) { ip = IPAddress.Parse(ipstring); end = new IPEndPoint(ip, 6113); listensocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); chatlist = new MenuList(new Rectangle(50, 50, 350, 450)); components.Add(new TextInput(new Rectangle(50, 500, 350, 40), ChatSend)); components.Add(new MenuButton(new Rectangle(450, 200, 150, 40), "Start Game", StartGame)); components.Add(chatlist); HostThread ht = new HostThread(listensocket, end, chatlist); Thread t2 = new Thread(new ThreadStart(ht.SendRecieve)); t2.Start(); }
public void EndTurn() { if (busy) { return; } busy = true; done = false; HostThread ht = new HostThread(listensocket, end, commands, ReturnCommands, numclients); commands = new List<Command>(); Thread t = new Thread(new ThreadStart(ht.SendRecieve)); t.Start(); }
private Host() { Thread = new HostThread(); }
public void SendMap() { if (busy) { return; } busy = true; done = false; HostThread ht = new HostThread(listensocket, end, map, ReturnCommands, numclients); commands = new List<Command>(); Thread t = new Thread(new ThreadStart(ht.SendRecieve)); t.Start(); //Thread.Sleep(60000); //blocking! //ht.SendRecieve(); }