Hi all,
I have written a simple server written in GNU Prolog opening a socket
for a client. After the job is done I close the streams and terminate
the program.
However, after terminating, the socket stays blocked for some time (like
2 minutes), I get a:
system_error(cannot_catch_throw(error(system_error('Address already in
use'),socket_bind/2)))
I am using it under a 64bit Linux. Is this normal behaviour or is there
something wrong with my code? To set up the socket I do:
socket('AF_INET', Des),
socket_bind(Des, 'AF_INET'(Host,Port)),
socket_listen(Des, 1),
socket_accept(Des, Client, StreamIn, StreamOut),
repeat,
read(StreamIn, Query),
...
write(StreamOut, Solution),
fail.
To close the connection I do:
close(StreamIn),
close(StreamOut)
I also tried adding a:
socket_close(Des)
But that did not help.
The full source is here:
http://www.cs.ru.nl/~lf/tools/treesolver/treeSolver.pl
Thanks for all hints, and cheers,
Lars
_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog