📄 gsipserver.java
字号:
/*
* Created on Jan 8, 2006
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.GTADS.server;
import java.io.IOException;
import java.net.*;
import org.GTADS.debug.ServerLogger;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class GSIPServer extends Thread {
public static GSIPServer instance;
private ServerSocket GSIPSocket;
private Socket clientConnection;
public static GSIPServer getInstance(){
if (instance == null){
instance = new GSIPServer();
}
return instance;
}
public static void clearInstance(){
if (instance != null){
instance = null;
}
}
public GSIPServer() {
start();
}
private void listenForClients() throws IOException{
GSIPSocket = new ServerSocket(ServerConfig.getInstance().getGSIPPort());
ServerLogger.sendConsoleOutput("GSIP Server started on port " + ServerConfig.getInstance().getGSIPPort(),
this.getClass());
while(true) {
clientConnection = GSIPSocket.accept();
ServerLogger.sendConsoleDebugMessage("Incoming Connection on GSIP Server", this.getClass(), 5);
new GSIPSThread(clientConnection);
}
}
public void run() {
try {
listenForClients();
} catch (IOException ioe){
ServerLogger.sendConsoleOutput("GSIP Server not started", this.getClass());
ServerLogger.sendConsoleDebugMessage("GSIP Server Port " + ServerConfig.getInstance().getGSIPPort() +
" used by another process!", this.getClass(), 2);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -