socket/socket-stream confusion in tests
Hi,
The tests USOCKET-TEST::SOCKET-LISTEN.1 and USOCKET-TEST::SOCKET-LISTEN.2 fail on sbcl 2.5.0 with errors like:
#<TYPE-ERROR expected-type: STREAM..
[condition]
Slots with :INSTANCE allocation:
DATUM = #<SB-BSD-SOCKETS:INET-SOCKET fd: 7 {10014C5923}>
EXPECTED-TYPE = STREAM
CONTEXT = NIL
Test USOCKET-TEST::SOCKET-LISTEN.2 failed
This code has (read-byte (usocket:socket server)) while I expected (read-byte (usocket:socket-stream server)). In fact with this the tests works.
Is this a fault in the test or in the usocket:socket function? From the documentation it is not clear to me.
Hello,
I think (read-byte (usocket:socket-stream server)) is the correct way, while (read-byte (usocket:socket server)) may also work for those backends in which the underlying "socket" (TCP) is also a valid Common Lisp stream (which supports functions like read-byte. This is still the case for LispWorks). I guess SBCL's behavior has changed in recent version, and this issue has been now exposed.
I will fix the test code (and review other testing failures).
Thanks,
Chun Tian