#define HOST "130.236.254.159" #define PORT 2000 program connectionp=compile_file("/users/cardeci/ulpc/connection.lpc"); mapping connections=([ ]); string random_name() { int i; string s=""; for(i=0; i<20; i++) s += sprintf("%c", 'a' + random('z'-'a')); return s; } string new_connection(string name, object f, string old) { object c; c=clone(connectionp, name, f, old); if(c->connect(HOST, PORT)) connections[name]=c; return -1; } mixed parse(mapping id) { mapping v; v=id["got"]["variables"]; if(connections[v["connection"]]) { connections[v["connection"]]->send(v["command"], id["file"]); } else { return new_connection(random_name(), id["file"], v["connection"]); } return -1; }