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

📄 chatter.java

📁 java3D game engine design of the source [three-dimensionalvirtualrealitynetworkprogram] - "virtual
💻 JAVA
字号:

// Chatter.java
// Andrew Davison, June 2003 (dandrew@ratree.psu.ac.th)

/* Stores information about a single client:
    the client's IP address, port, and output stream

  The output stream is used to send messages to the client.

  The address and port are used to uniquely identify the
  client (the client has no name).
*/

import java.io.*;


public class Chatter
{
  private String cliAddr;
  private int port;
  private PrintWriter out;

  public Chatter(String cliAddr, int port, PrintWriter out)
  { this.cliAddr = cliAddr;
    this.port = port; this.out = out;
  }


  public boolean matches(String ca, int p)
  // the address and port of a client are used to uniquely identify it
  { if (cliAddr.equals(ca) && (port == p))
      return true;
    return false;
  } // end of matches()
 

  public void sendMessage(String msg)
  {  out.println(msg);  }


  public String toString()
  {  return cliAddr + " & " + port + " & ";  }


}  // end of Chatter class

⌨️ 快捷键说明

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