debug16_3.java

来自「北京大学出版社的」· Java 代码 · 共 33 行

JAVA
33
字号
package questions.c16;
import java.io.*;
import java.net.*;
public class Debug16_3 {
   private InetAddress host;
   private int port;
   public Debug16_3( InetAddress host, int port ) {
      this.host = host;
      this.port = port;
   }
   public void run() {
      try {
         Socket client = new Socket();
         PrintWriter socketOut = client.getPrintWriter();
         socketOut.println( "Test message" );
         client.close();
      }
      catch( IOException iox ) {
         System.out.println( iox );
         iox.printStackTrace();
      }
   }
   public static void main( String[] args ) {
      try {
         InetAddress host = InetAddress.getLocalHost();
         Debug16_3 client = new Debug16_3( host, 8189 );
         client.run();
      }
      catch ( UnknownHostException uhx ) {
         uhx.printStackTrace();
      }
   }
}

⌨️ 快捷键说明

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