zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package Method;
import java.net.Socket;
 
public class SocketListen extends Thread{
    public  Socket socket;
    @SuppressWarnings("static-access")
    public void run(Socket socket){
         while(true){
                    try {
                        socket.sendUrgentData(0xFF);
                        this.socket=socket;
                        
                    } catch (Exception e) {
                        System.out.println("¼àÌý¶Ë¿ÚÏß³Ì...");
                        String url = "172.16.104.45:9991";
                        String host = url.substring(0, url.indexOf(':'));
                        int port = Integer.parseInt(url.substring(url.indexOf(':') + 1));
                        try {
                            this.socket = new Socket(host, port);
                        } catch (Exception e1) {
                            e1.printStackTrace();
                        }
                        e.printStackTrace();
                    }
            
             try {
                this.sleep(3000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
         }
     }
 
}