Package networking.request

Examples of networking.request.GameRequest


//                    if (requestCode != Constants.CMSG_HEARTBEAT) {
//                        System.out.println("Request code is : " + requestCode);
//                    }

                    GameRequest request = GameRequestTable.get(requestCode);

                    //If the request if valid, process like following:
                    if (request != null) {
                        request.setGameClient(this);
                        //Pass the realInputStream to the request object.
                        request.setDataInputStream(dataInput);
                        //The request object parses the realInputStream.
                        request.parse();
                        //The request object process business.
                        request.doBusiness();
                        //Get the response created by the request object.
                        for (GameResponse response : request.getResponses()) {
                            //Construct the response from an object to an outputStream.
                            outputStream.write(response.constructResponseInBytes());
                        }

//                        response.printResponse();
View Full Code Here


    /*
     * Get the request class by the given request code.
     */
    public static GameRequest get(short requestID) {
        GameRequest request = null;

        try {
            Class name = requestNames.get(requestID);

            if (name != null) {
                request = (GameRequest) name.newInstance();
                request.setID(requestID);
            } else {
                System.err.println("Invalid Request Code: " + requestID);
            }
        } catch (Exception e) {
            System.err.println(e.getMessage());
View Full Code Here

TOP

Related Classes of networking.request.GameRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.