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

📄 chapter19n7.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/** * program to demonstrate simple use of a Socket */import java.io.* ;import java.net.* ;import java.lancs.* ;public class Chapter19n7    {    public static void main(String[] args) throws Exception	{        BasicIo.prompt("host name? ") ;	String hostName = BasicIo.readString() ;        BasicIo.prompt("port number? ") ;	int portNumber = BasicIo.readInteger() ;	try {	    System.out.println("**attempting connection**") ;	    Socket s = new Socket(hostName, portNumber) ;	    System.out.println("**made connection**") ;	    BufferedReader s1 =		 new BufferedReader(new InputStreamReader(s.getInputStream())) ;	    System.out.println("**START OF INPUT**") ;	    while (true)		{		String line = s1.readLine() ;		if (line == null)		    break ;		System.out.println(line) ;		}	    System.out.println("**END OF INPUT**") ;	    }        catch(IOException e)	    {	    System.out.println("ERROR: " + e) ;	    }	} // end of main method    } // end of class Chapter19n7

⌨️ 快捷键说明

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