Re: incorrect value with socket stream and open-stream-p

Martin Simmons <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
Connecting, using and disconnecting a socket stream from different processes
should be OK as long as you don't do that simultaneously.  Looking at the
code, I can't see any way that OPEN-STREAM-P could return nil (and I/O could
get STREAM-CLOSED-ERROR) if nothing has called CLOSE on the stream.

The STREAM::OPEN-P slot in COMM:SOCKET-STREAM isn't actually used to record
that state, so it will always be T.

What is the printed representation of the STREAM::BUFFER-STATE slot when you
get the unexpected error?

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/



>>>>> On Fri, 6 Mar 2026 17:42:18 +0000, John DeSoi (as john at desoi dot dev) said:
> 
> I'm using comm:open-tcp-stream to connect to PostgreSQL. When calling the disconnect function, sometimes open-stream-p returns nil when (1) the connection has never been closed and (2) PostgreSQL shows the connection is active. In the debugger the slot value for STREAM::OPEN-P is T. I tried to use this to send the termination request and close the connection, but that results in a STREAM-CLOSED-ERROR.
> 
> In the case I'm testing, the disconnect operation is not being executed in the same process as the connection stream. Does this matter? I could not find any kind of limitation in the documentation. I'm using LW 8.1.2 on macOS.
> 
> Thanks,
> 
> John DeSoi, Ph.D.
> 
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> [email protected]
> http://www.lispworks.com/support/lisp-hug.html
> 

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.