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

📄 server.java

📁 一本非常经典的书籍阿!
💻 JAVA
字号:
import java.net.*;import java.io.*;public class Server{	public static void main(String[] args) throws IOException {		Socket client = null;		PrintWriter pout = null;		ServerSocket sock = null;		try {			sock = new ServerSocket(5155);			// now listen for connections			while (true) {				client = sock.accept();				// we have a connection				pout = new PrintWriter(client.getOutputStream(), true);				// write the Date to the socket				pout.println(new java.util.Date().toString());				pout.close();				client.close();			}		}		catch (IOException ioe) {				System.err.println(ioe);		}		finally {			if (sock != null)				sock.close();			if (client != null)				client.close();		}	}}

⌨️ 快捷键说明

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