// if(args.length == 0)
// return;
Socket sck = null;
PrintWriter pw = null;
try {
System.out.println("StartSocket: passing startup args to already-running Azureus java process.");
sck = new Socket("127.0.0.1", 6880);
pw = new PrintWriter(new OutputStreamWriter(sck.getOutputStream(),"UTF8"));
StringBuffer buffer = new StringBuffer("Azureus Start Server Access;args;");
for(int i = 0 ; i < args.length ; i++) {
String arg = args[i].replaceAll("&","&&").replaceAll(";","&;");
buffer.append(arg);
buffer.append(';");
}
pw.println(buffer.toString());
pw.flush();
} catch(Exception e) {
Debug.printStackTrace( e );
} finally {
try {
if (pw != null)
pw.close();
} catch (Exception e) {
}
try {
if (sck != null)
sck.close();
} catch (Exception e) {
}
}