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

📄 simpleclient.java

📁 网络+多线程+输入输出流的结合运用
💻 JAVA
字号:
package socket;
import java.net.*;
   import java.io.*;

   public class SimpleClient {
   public static void main(String args[]) throws IOException {

   Socket s1;
   InputStream s1In;
   DataInputStream dis;

   // Open your connection to sunbert, at port 5432
   s1 = new Socket("localhost",5432);

   // Get an input file handle from the socket and read the input
   s1In = s1.getInputStream();
   dis = new DataInputStream(s1In);

   String st = new String (dis.readUTF());
   System.out.println(st);

   // When done, just close the connection and exit
   s1In.close();
   s1.close();
   } //end of method main()
   } //end of class SimpleClient()

⌨️ 快捷键说明

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