public SessionSocket(Socket socket, RelaySessionServer server) : base(socket, server) { this.t = new Thread(this.receive); this.t.Start(); this.server = server; }
public void startHost(int cp, string host, int sp) { this.clientHost = host; this.clientPort = cp; this.serverPort = sp; hostID = Protocol.TUniqueID.generate(); worldID = Protocol.TUniqueID.generate(); buffer = new MessageBuffer(this); sessionClient = new RelaySessionClient("SessionClient1", host, clientPort + 1, this, buffer); infoClient = new RelayInfoClient("InfoClient1", clientHost, clientPort, this); sessionServer = new RelaySessionServer("SessionServer1", serverPort + 1, this, buffer); infoServer = new RelayInfoServer("InfoServer1", serverPort, this); Statistics stats = new Statistics(buffer, sessionClient, sessionServer); sessionClient.setServer(sessionServer); infoClient.setServer(infoServer); if (infoClient.connect() && sessionClient.connect()) { Log.notify("Clients connected", this); if (infoServer.connect() && sessionServer.connect()) { Log.notify("Server started on port " + serverPort, this); Console.ReadLine(); disconnect(); } else { Log.error("Failed to start server", this); } } else { Log.error("Failed to connect gameclient", this); } }
public void startHost(int cp, string host, int sp) { this.clientHost = host; this.clientPort = cp; this.serverPort = sp; hostID = Protocol.TUniqueID.generate(); worldID = Protocol.TUniqueID.generate(); buffer = new MessageBuffer(this); sessionClient = new RelaySessionClient("SessionClient1", host, clientPort + 1, this, buffer); infoClient = new RelayInfoClient("InfoClient1", clientHost, clientPort, this); sessionServer = new RelaySessionServer("SessionServer1", serverPort + 1,this, buffer); infoServer = new RelayInfoServer("InfoServer1", serverPort, this); Statistics stats = new Statistics(buffer, sessionClient, sessionServer); sessionClient.setServer(sessionServer); infoClient.setServer(infoServer); if (infoClient.connect() && sessionClient.connect()) { Log.notify("Clients connected", this); if(infoServer.connect() && sessionServer.connect()) { Log.notify("Server started on port "+serverPort, this); Console.ReadLine(); disconnect(); } else { Log.error("Failed to start server", this); } } else { Log.error("Failed to connect gameclient", this); } }