From starred@tiscalinet.it Wed Aug 22 10:59:54 2001
Received: from mailrelay2.inwind.it ([212.141.54.102])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f7M8xrb22904
	for <prolog@swi.psy.uva.nl>; Wed, 22 Aug 2001 10:59:54 +0200 (MET DST)
Received: from tiscalinet.it (62.98.196.197) by mailrelay2.inwind.it (5.5.029)
        id 3B4502A100B2C7B1; Wed, 22 Aug 2001 10:59:21 +0200
Message-ID: <3B837493.E1A9E872@tiscalinet.it>
Date: Wed, 22 Aug 2001 11:00:03 +0200
From: Armando Stellato <starred@tiscalinet.it>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: Lesta <Lesta@SBS-Softwaresysteme.de>
CC: swi prolog mailing list <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] How connect to a server via socket's on Windows
References: <00a201c12a5b$3ac2ccc0$390a0a0a@lesta2> <3B8296A0.8BA517AA@tiscalinet.it> <002f01c12ade$c35be390$1700000a@SBS.SBSSoftwaresysteme.de>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Oh! I didn't read well a thing you have specified clearly!
This is a client and not a server!
Well, the procedure you wrote is for the server, that's because i misunderstood:
for a client you have to write:

tcp_socket(Socket),
tcp_connect(Socket, Host:Port),
<optionally: (tcp_fcntl(Socket, setfl, nonblock),)>
tcp_open_socket(Socket, ReadFd, WriteFd).

You received that error because you were, de facto, opening another server on the
same port, so the port was always occupied by the original server.

Anyway, there's a clear example in the directory demo in the package clib-1.2.1
that u may download from the SWI page.
If you have other problems, let me know.
Bye
Armando

Lesta wrote:

> ----- Original Message -----
> From: "Armando Stellato" <starred@tiscalinet.it>
> To: "Lesta" <Lesta@sbs-softwaresysteme.de>
> Subject: Re: [SWIPL] How connect to a server via socket's on Windows
>
> > This is probably the error it gives you every second time that you start
> the
> > program,
>
> No, it appears always
>
> > infact you are creating a socket listener bound to port 5665 and if you
> don't
> > close the socket at the end of the program, you will find the port
> occupied when
> > you'll restart it.
>
> The first number after '$socket'( ist increase by 4 each start of the prog.
> I am not sure zo have the right way th open the socket in client mode.
>
> Uwe
> > > Hello to all of you,
> > >
> > > I like to build a cliet on a windows2000 machine
> > > comunicate via sockets using pl-4.0.9.
> > >
> > > test:-
> > >     tcp_socket(S),
> > >     tcp_bind(S,5665),
> > >     tcp_open_socket(S, IN, OUT),
> > >     ...
> > >
> > > results in the error msg :
> > > ERROR: Unknown error term: socket_error('No such file or directory')
> > >    Exception: (8) socket:tcp_bind('$socket'(396), 5665) ?
> > > in tcp_bind.
> > >
> > > Can someone help me, perhaps with a small example ?
> > >
> > > Thanks in advance
> > >
> > > --
> > >
> > > Kind regards
> > >
> > > Uwe
> > > Lesta@t-online.de
>
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
>
> or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
> (without the quotes) and *no* message body.
>
> ** An ARCHIVE of this list is maintained at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/

