// requires photoshop CS5+ and run in Photoshop conn = new Socket(); var keep_serving = true; while (keep_serving) { if (conn.listen(8123)) // any port { // wait forever for a connection var incoming; do incoming = conn.poll(); while (incoming == null); new_cmd = incoming.read(); try { if (null != new_cmd) { result =eval(new_cmd); incoming.writeln(result + "\nOK\n"); } else { incoming.writeln("no command\nFAIL\n"); } } catch (err) { incoming.writeln(err + "FAIL\n"); incoming.close(); delete incoming; } } }