client:- client(localhost,7001). client(H,P):- client(H,P,none). client(H,P,W):- that_host<=H, that_port<=P, password<=W, that_service<=stopped. start_client:- that_host=>H, that_port=>P, new_client(H,P,Client), that_service<=Client. run(Goal):- that_host=>H, that_port=>P, password=>W, remote_run(H,P,Goal,Goal,W,the(Goal)). ask(X,G,R):- if(that_service=>stopped,start_client,true), that_service=>Client, password=>W, ask_service(Client,X,G,W,R). ask(G):-ask(G,G,the(G)). disconnect:- that_service=>Client, ask(let(service_finished,yes)), disconnect(Client), client<=stopped. test_client1:- test_client(1000,_,true). test_client2:- test_client(100,I,println(I)). test_client3:- test_client(100,_,findall(K,for(K,1,10),Ks)), println(Ks). test_client(N,I,G):- println(test_client(N,G)), test_client(N,I,G,T), println(time=T). test_client(N,I,G,T):- ctime(T1), for(I,1,N), ( ask(G)->true ; !,println(unexpected_failure(I,G)) ), I=N, disconnect, ctime(T2), T is T2-T1.