public PlayerComm(TcpClient p, ServerMessageQueue smq, int mess, int pn) { player = p; messages = smq; playerStream = player.GetStream(); messageSize = mess; encoder = new ASCIIEncoding(); playerID = pn; obsChanged = false; joinLock = new object(); }
//constructor creates the socket and threads to listen to new connections public WondersServer(int p) { playersList = new PlayerThreadData[7]; port = p; listenSocket = new TcpListener(IPAddress.Any, port); mQueue = new ServerMessageQueue(); ASCIIEncoding encoder = new ASCIIEncoding(); full = encoder.GetBytes("full"); serverLock = new object(); change = false; timer = new CommTimer(mQueue); }
public CommTimer(ServerMessageQueue q) { mQueue = q; timer = new System.Timers.Timer(2000); timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); }