private void Server_ClientAvailable(object sender, CommunicationListenerEventArgs e) { if (!havePlayer) { client = e.Client; client.DataAvailable += Client_DataAvailable; havePlayer = true; SendClientTurnMessage(); RenderFromThread(); } }
public void AcceptCallback(IAsyncResult ar) { // Signal the main thread to continue. allDone.Set(); // Get the socket that handles the client request. Socket listener = (Socket)ar.AsyncState; Socket handler = listener.EndAccept(ar); CommunicationListenerEventArgs args = new CommunicationListenerEventArgs(); args.Client = new SocketCommunicationClient(handler); OnClientAvailable(args); }
protected virtual void OnClientAvailable(CommunicationListenerEventArgs args) { ClientAvailable?.Invoke(this, args); }