|
From: | Peter van Eerten |
Subject: | Line based buffers malfunctioning in Win32? |
Date: | Mon, 29 Dec 2003 02:16:34 -0800 |
Hi all,
This is probably a very stupid problem, but I'll
ask anyway, sincerely hoping nobody gets offensed. For my GTK-server I am
experimenting with communication to an external process using TCP. By default, a
TCP socket in GNU Prolog is buffered in block mode, and after a block of
data, an explicit "flush_output/1" is needed to send the contents of the buffer
to the socket.
When I change the buffermode (with
"set_stream_buffering/2") to line, it seems that GNU Prolog is not able to
actually send away the data after a newline. For example:
socket('AF_INET',
Socket),
socket_connect(Socket, 'AF_INET'(localhost, 50000), In, Out), set_stream_buffering(Out, line),
write(Out, 'Hello there'), nl(Out), read_token(In, _), .....<more code>.....
The "Hello there" is never received by the other side. This works
neither:
socket('AF_INET',
Socket),
socket_connect(Socket, 'AF_INET'(localhost, 50000), In, Out), set_stream_buffering(Out, line),
write(Out, 'Hello there\n'), read_token(In, _), .....<more
code>..... The strange thing is, when I put the incoming
stream to line mode, and keep using "read_token/2", it works perfectly
OK. I also have tried other versions of "write", like "writeq",
"write_term", etc., but that did not help me out.
Probably I am doing something wrong? Or is
this some kind of buggy behaviour (let's hope not)? I saw this
problem when using GNU Prolog 1.2.16 with Windows2000 SP
1.
Thank you,
Peter.
-----------------------------------------------------------
|
[Prev in Thread] | Current Thread | [Next in Thread] |