package SocketIO;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.*;
class SocketThread extends Thread{
Socket client=null;
public SocketThread(Socket accept) {
}
@Override
public void run() {
System.out.println("被訪問");
super.run();
}
}
public class MTServer extends ServerSocket{
Scanner input=new Scanner(System.in);
private final int PORT = 20248;
ServerSocket ss=new ServerSocket(PORT);
public MTServer() throws Exception {
super();
while(true){
new SocketThread(ss.accept()).start();
}
}
public static void main(String[] args) {
try {
MTServer server=new MTServer() ;
} catch (Exception e) {
System.out.println("錯誤緣由:"+e.getMessage());
e.printStackTrace();
}java
}ide
}.net