Package megamek.common.net

Examples of megamek.common.net.Packet


     *            a <code>Vector</code> of <code>Building</code>s that need
     *            to be updated.
     * @return a <code>Packet</code> for the command.
     */
    private Packet createUpdateBuildingCFPacket(Vector<Building> buildings) {
        return new Packet(Packet.COMMAND_BLDG_UPDATE_CF, buildings);
    }
View Full Code Here


     */
    public Packet unmarshall(InputStream stream) throws Exception {
        ObjectInputStream in = new ObjectInputStream(stream);
        int command = in.readInt();
        Object[] data = (Object[]) in.readObject();
        return new Packet(command, data);
    }
View Full Code Here

        Enumeration<?> rootChildren = root.elements();
        if (!rootChildren.hasMoreElements()) {
            throw new ParseException("No children of the root.");
        }
        ParsedXML rootNode = (ParsedXML) rootChildren.nextElement();
        Packet packet = PacketEncoder.decode(rootNode, null);
        return packet;
    }
View Full Code Here

    /**
     * Send the loaded board to the peer.
     */
    public void send() {
        long start = conn.bytesSent();
        Packet packet = new Packet(Packet.COMMAND_SENDING_BOARD, board);
        /*
         * 2003-12-21 : prove connectivity first, then add refinements * like
         * data compression. packet.zipData();
         */
        conn.send(packet);
View Full Code Here

     * Shuts down threads and sockets
     */
    public void die() {
        // If we're still connected, tell the server that we're going down.
        if (connected) {
            send(new Packet(Packet.COMMAND_CLOSE_CONNECTION));
            flushConn();
        }
        connected = false;

        if (connection != null) {
View Full Code Here

     * Send command to unload stranded entities to the server
     */
    public void sendUnloadStranded(int[] entityIds) {
        Object[] data = new Object[1];
        data[0] = entityIds;
        send(new Packet(Packet.COMMAND_UNLOAD_STRANDED, data));
    }
View Full Code Here

     * Send mode-change data to the server
     */
    public void sendModeChange(int nEntity, int nEquip, int nMode) {
        Object[] data = { new Integer(nEntity), new Integer(nEquip),
                new Integer(nMode) };
        send(new Packet(Packet.COMMAND_ENTITY_MODECHANGE, data));
    }
View Full Code Here

     * Send system mode-change data to the server
     */
    public void sendSystemModeChange(int nEntity, int nSystem, int nMode) {
        Object[] data = { new Integer(nEntity), new Integer(nSystem),
                new Integer(nMode) };
        send(new Packet(Packet.COMMAND_ENTITY_SYSTEMMODECHANGE, data));
    }
View Full Code Here

     * Send mode-change data to the server
     */
    public void sendAmmoChange(int nEntity, int nWeapon, int nAmmo) {
        Object[] data = { new Integer(nEntity), new Integer(nWeapon),
                new Integer(nAmmo) };
        send(new Packet(Packet.COMMAND_ENTITY_AMMOCHANGE, data));
    }
View Full Code Here

        Object[] data = new Object[2];

        data[0] = new Integer(id);
        data[1] = md;

        send(new Packet(Packet.COMMAND_ENTITY_MOVE, data));
    }
View Full Code Here

TOP

Related Classes of megamek.common.net.Packet

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.