:- package(socket). main([Name,Port,Command]) :- atom_codes(Port,List), number_codes(Portno, List), socket__create(Name,Portno,Socket), open(Socket,write,Out,[socket,text]), open(Socket,read,In,[socket]), write(Out, 'GET /cgi-bin/'), write(Out, Command), nl(Out), nl(Out), flush_output(Out), repeat, get_char(In, C), ( C = end_of_file ; put_char(C), fail ), !, close(In), close(Out).