1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| pnl :-
read_string(user_input, "!?.", """\n", End, P),
% connexion au serveur
tcp_socket(Socket),
Host='localhost', Port=8001,
writeln("Connect..."),
tcp_connect(Socket, Host:Port),
writeln(" done"),
writeln("open socket..."),
tcp_open_socket(Socket, ReadFd, WriteFd),
writeln(" done"),
writeln("% envoi des données"),
writeln(P),
string(P),
format(WriteFd, '~s', [P]),
flush_output(WriteFd),
/* la chaîne en arrivant est vide.
close(WriteFd),
writeln("% récupétation des résultats"),
/* le programme s'arrête ici */ Peut-être normal.
read_line_to_codes(ReadFd, L),
writeln("% close"),
close(ReadFd),
writeln("% liste_to_codes"),
string_codes(S, L),
writeln("input_to_list"),
input_to_list(S, List, Sentence),
writeln("and others"),
length(List, Length),
nth1(Length, List, At_End),
char_code(At_End, End),
pnl_dialog(List, Sentence, End),
pnl. |