}
public void run() {
bContinue = true;
while (bContinue) {
BufferedReader br = null;
try {
Socket sck = socket.accept();
String address = sck.getInetAddress().getHostAddress();
if (address.equals("localhost") || address.equals("127.0.0.1")) {
br = new BufferedReader(new InputStreamReader(sck.getInputStream()));
String line = br.readLine();
//System.out.println("received : " + line);
if (line != null) {
// main.showMainWindow();
StringTokenizer st = new StringTokenizer(line, ";");
List argsList = new ArrayList();
while( st.hasMoreElements() )
argsList.add(st.nextToken().replaceAll("&;", ";").replaceAll("&&", "&"));
if (argsList.size() > 1 )
{
String checker = (String) argsList.remove(0);
if (checker.equals(AzureusCoreSingleInstanceClient.ACCESS_STRING)) {
if (argsList.get(0).equals("args")) {
argsList.remove(0);
String newargs[] = new String[argsList.size()];
argsList.toArray(newargs);
Main.processArgs(newargs, null, null);
} else {
Logger.getLogger("azureus2").error("Something strange was sent to the StartServer: " + line);
}
} else {
Logger.getLogger("azureus2").error("StartServer: Wrong access token.");
}
}
}
}
sck.close();
} catch (Exception e) {
if (!(e instanceof SocketException))
e.printStackTrace();
bContinue = false;
} finally {
try {
if (br != null)
br.close();
} catch (Exception e) {
}
}
}
}