1
2
3
4
5
6
7
8
9
10
|
start:-start(localhost).
start(Host):-start(Host, 8068).
start(Host,Port):-
socket('AF_INET', Socket),
hostname_address(Host, HostAddress),
socket_connect(Socket, 'AF_INET'(HostAddress, Port), StreamIn, StreamOut),
write(StreamOut, c), flush_output(StreamOut),
read_atom(StreamIn, X), write(X), nl,
socket_close(Socket).
|