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

📄 dayclient.java

📁 These two classes show an extremely simple example of java.net socket programming. They implement th
💻 JAVA
字号:


import java.io.*;
import java.net.*;

/**
 * Tiny socket client for the Unix 'daytime' protocol.
 */

public class Dayclient
{
    public static void main(String[] args)
    {
	Socket csocket;
	BufferedReader   timestream;
	if (args.length < 1) {
	    System.err.println("Please supply a host name or IP address");
	    System.exit(0);
	}
	try
	    {
		csocket = new Socket(args[0],13);
		timestream = new BufferedReader(new InputStreamReader(csocket.getInputStream()));
		String thetime = timestream.readLine();
		System.out.println("it is "+ thetime + " at " + args[0]);

       
		csocket.close();
          
	    }

	catch(IOException e)
	    { System.err.println(e);}

    }
}
 

⌨️ 快捷键说明

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