static void Main(string[] args) { parser p1 = new parser(); //p1.createMap(); //p1.printMap(); Console.Read(); Console.WriteLine(parser.game); view v1 = new view(); v1.ShowDialog(); /* connect con = new connect(); con.send("JOIN#"); con.listen(); char str = ' '; while (str!='q') { str = Console.ReadKey().KeyChar; if (str == 'w') con.send("UP#"); else if (str == 's') con.send("DOWN#"); else if (str == 'a') con.send("LEFT#"); else if (str == 'd') con.send("RIGHT#"); else if (str == 'i') con.send("SHOOT#"); }*/ }
public void receiveData() { try { Console.WriteLine("Recieve Data Running"); TcpListener listner = new TcpListener(IPAddress.Parse("127.0.0.1"), 7000); string msg = null; listner.Start(); parser p2 = new parser(); while (true) { try { Socket s = listner.AcceptSocket(); if (s.Connected) { NetworkStream stream = new NetworkStream(s); List<Byte> inputStr = new List<byte>(); int asw = 0; while (asw != -1) { asw = stream.ReadByte(); inputStr.Add((Byte)asw); } msg = Encoding.UTF8.GetString(inputStr.ToArray()); //Console.WriteLine(reply); //stream.Close(); //listner .Stop(); //gameViwe.drow(msg); p2.evaluate(msg); } //Console.WriteLine(msg); gameView.ShowDialog(); } catch { //Console.WriteLine("Error"); } } } catch { Console.WriteLine("Error- Finished"); return ; } //listner.Stop(); }