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

📄 sockettest.java

📁 gcc的组建
💻 JAVA
字号:
import java.net.*;public class SocketTest{  public static void main(String args[])    {      try {	Socket socket = new Socket("www.hungry.com", 80);	InetAddress remote = socket.getInetAddress();	InetAddress local = socket.getLocalAddress();        int rport = socket.getPort();	int lport = socket.getLocalPort();	socket.setSoTimeout(socket.getSoTimeout());	socket.setTcpNoDelay(socket.getTcpNoDelay());	int linger = socket.getSoLinger();	if (-1 != linger)		socket.setSoLinger(true, linger);	else		socket.setSoLinger(false, 0);	String socketString = socket.toString();	if (null == socketString)		throw new Exception("toString() failed");	socket.close();	System.out.println("PASSED: new Socket()" + socketString);      } catch (Exception e) {	System.out.println("FAILED: " + e);      }    }}

⌨️ 快捷键说明

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