public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; lastState = new KeyboardState(); server = new GameServer(); }
public GameServer(int port = 8024) { if (currentInstance == null) { currentInstance = this; } else { throw new Exception("only one instance of GameServer is allowed!"); } portNumber = port; }
public void Dispose() { currentInstance = null; }
public Connection(GameServer server, Socket socket) { _socket = socket; _server = server; _socket.BeginReceive(buffer, 0, 256, SocketFlags.None, new AsyncCallback(ReceiveData), _socket); _socket.BeginDisconnect(false, new AsyncCallback(Disconnect), null); }