package com; import java.net.ServerSocket; import java.net.Socket; import java.io.*; public class Server extends Thread { private ServerSocket ss = null; public Server(){ try { ss = new ServerSocket(7456); } catch (IOException e) { e.printStackTrace(); } } public void run(){ while(true){ try { System.out.println("-------------服务启动------------"); Socket socket = ss.accept(); ServerThread st = new ServerThread(socket); st.start(); } catch (IOException e) { e.printStackTrace(); } } } public static void main(String[] args) throws Exception { new Server().start(); } }
最近下载更多