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

📄 testclient1.java

📁 JAVA的高级应用以及网络编程
💻 JAVA
字号:
import java.net.*;
import java.io.*;
public class TestClient1{
	public static void main(String args[]){
	   client();
	}
	public static void client(){
		try{
			//Socket s=new Socket("10.0.0.4",6000);
			Socket s=new Socket(InetAddress.getByName(null),6000);
			OutputStream os=s.getOutputStream();
			InputStream is=s.getInputStream();
			byte [] buf=new byte[100];
			System.out.println("client starting...");
			int len=is.read(buf);
			System.out.println(new String(buf,0,len));
			os.write("Hello,this is the lisi.".getBytes());
			os.close();
			is.close();
			s.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

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