public GameServer(PlayPage playpage, string name, string portUDP1, string portUDP2, string portTCP1L, string portTCP1S, string portTCP2L, string portTCP2S, string portTCP3L, string portTCP3S) { serverBussyflag = false; this.playpage = playpage; gameData = new GameData(); serverUDP = new UDPListener(playpage, name, portUDP1, portUDP2); firstConnectionClient = TCPClientRemote.Instance; firstConnectionClient.initTCPClient(playpage, name); firstConnectionClient.initListener(portTCP3L); firstConnectionClient.Received += firstConnectionReceived; this.portTCP3S = portTCP3S; this.portTCP2S = portTCP2S; this.portTCP1L = portTCP1L; server = new Server(playpage, portTCP2S); server.Received1 += onServerRecieved1; server.Received2 += onServerRecieved2; client = TCPClientRemote.Instance; client.initTCPClient(playpage, name); client.Received += OnReceived1; server.addForPlayer1Listener(portTCP1L); client.initListener(portTCP1S); server.addForPlayer2Listener(portTCP2L); client.initSender(portTCP1L, IPAdress.LocalIPAddress()); server.addForPlayer1Sender(portTCP1S, IPAdress.LocalIPAddress()); server.addForPlayer2Listener(portTCP2L); }
public Server(PlayPage playPage, string portSender, string name = "Server") { this.Client1 = TCPClientRemote.Instance; Client1.initTCPClient(playPage, name); this.Client2 = TCPClientRemote.Instance; Client2.initTCPClient(playPage, name); this.playPage = playPage; this.portSender = portSender; Client1.Received += OnReceived1; Client2.Received += OnReceived2; }