相关代码 |
|
// 程序:简单的连线服务器端 // 范例文件:Server.java import java.io.*; import java.net.*; public class Server { public static void main(String args[]) { try { ServerSocket S = new ServerSocket(6633); System.out.println("等待连线中..."); Socket C = S.accept(); PrintStream write = new PrintStream(C.getOutputStream()); write.println(C.getInetAddress().getHostName() + "欢迎光临"); C.close(); S.close(); } catch(IOException E){} } }
相关资源 |
|