⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientthread.java

📁 Massively Multiplayer Space Trading and Combat game. This is an online strategy game, not a 3D space
💻 JAVA
字号:
/*
 * ClientThread.java
 *
 * Copyright (C) 2000 Jason M. Hanley
 * Released under the GNU General Public License (GPL)
 * See license.txt for additional information.
 *
 * Created on July 24, 2000, 9:52 PM
 */
 
package fate.network;

import java.io.*;

import fate.util.*;
import fate.messages.*;

/** 
 * Handles low-level processing of incoming messages from the server.
 *
 * @author  preylude@s3m.com
 * @version 0.1.0
 */
public class ClientThread extends Thread {

  ClientConnection parent;
  ObjectInputStream in;

  /** Creates new ClientThread */
  public ClientThread( ClientConnection parent, ObjectInputStream in ) {
    this.parent = parent;
    this.in = in;
  }
  
  /** Continues reading messages until an IO expection happens */
  public void run() {
    try {
      Debug.trace( "ClientThread entering message loop" );
      while (true) {
        parent.receiveMessage( in.readObject() );
      }
    } catch ( IOException e ) {
      // IO Exception.. gotta bail
      Debug.trace( "ERROR:ClientThread.run(): I/O Error");
      //@ TODO: error handling
    } catch ( ClassNotFoundException e ) {
      // Class not found.. this is bad too
      Debug.trace( "ERROR:ClientThread.run(): Class not found");
      //@ TODO: error handling
    }
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -