final/TestPort.java

13 lines
400 B
Java
Raw Permalink Normal View History

2025-12-21 21:47:25 +08:00
import java.net.Socket;
public class TestPort {
public static void main(String[] args) {
try {
Socket socket = new Socket("127.0.0.1", 8081);
System.out.println("Successfully connected to port 8081");
socket.close();
} catch (Exception e) {
System.out.println("Failed to connect to port 8081: " + e.getMessage());
}
}
}