[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie: redundant connection

From: carlos calderon
Subject: Newbie: redundant connection
Date: Sun, 17 Jun 2001 13:20:58 +0100

Hi all,
First off, sorry if I am over using the list with what are probably dull questions for some of you. but you've really helped, so thank you very much.
Now onto the question:
I wrote the following piece of code:
/*Solution is a list*/
sendlist(Solution) :-
/*create sockets*/
/*connect to server*/
socket_connect(Socket,'AF_INET'('', 1936), StreamInput,StreamOuput),
/*where xxx is my server's IP address*/
'$stream'(I) = StreamOutput,
/*close socket*/
My problem is that when I try to send the first solution to the server it works fine:
-create socket,
-connect to server
However for subsequent solutions, "obviously" generates a redundant connection attempt (socket_connect).
I guess what I need it's something like:
If connection=false then
-create socket
-connect to server
connection = true
Alternatively, I think I could do with a predicate like:
to the destroy the socket.
In the manual, pag 153, recommends to use close/2 to close the associated stream.
I've tried that but it doesn't work for me, I still get a redundant connection.
Any ideas about how to get around this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]