 
    
    
         
This is the socket client program of irpr. The procedure is as follows.
:- module main.
main :- client.
client :-
    unix:unix([connect(inet("localhost",8888),Result)]),
    client1(Result).
client1(normal(So)) :-
    merge(Si, So),
    unix:argv(ARGVL),
    klicio:klicio([stdout(OutResult),stdin(InResult)]),
    client2(ARGVL,InResult,OutResult,Si).
client2(["shutdown"],normal(Stdin),normal(Stdout),S) :-
    S = [fwrite("shutdown"),#"\n",fflush(_)],
    Stdin = [], Stdout = [].
otherwise.
client2([Mode],normal(Stdin),normal(Stdout),Soc) :-
    Soc = [ #"i", #"r", #"p", #"r", #"\n", fflush(_),
          fwrite(Mode), #"\n", fflush(Stat1)|{SocIn,SocOut}],
    irpr_lib:client_rw_loop(Stdin,SocOut,SocIn,Stdout).