socket接口网络编程
服务器 package test; import java.net.*; import java.io.*; public class kkmultiserver { private socket socket=null; private serversocket ss; string ip="192.168.1.182"; int port =8001; thread trd=null; public void start() { try { ss=new serversocket(port,20,inetaddress.getbyname(ip)); system.out.println("服务器建立等待用户连接!"); while(true) { socket=ss.accept(); system.out.println("用户连接成功"); trd=new thread(new guestserver(socket)); trd.start(); } } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } public static void main(string args[]) { new kkmultiserver().start(); } }