Hi,
On Jan 2, 2010, at 11:42 PM, Chun Tian (binghe) wrote:
Your file has been committed into USOCKET trunk [1], and I'll use it as my work base. What you didn't implement is the WAIT-FOR-INPUT-INTERNAL function, which used to detect if there's anything available to read in a group of sockets (it's based on select() on UNIX). I'll try to investigate how MCL do this job if you don't have a quick solution.
It seems like WAIT-FOR-INPUT-INTERNAL is like the CONNECTION-ESTABLISHED-P local function within SOCKET-ACCEPT in the usocket MCL backend draft that I sent you? Or is it more like LISTEN in Common Lisp?
It's more like LISTEN, but it can listen on multiple connections at the same time. So, do you have any idea on how to implement it?
And please notice: the WAIT-FOR-INPUT-INTERNAL should wait on "socket" but "stream", because that's what USOCKET API defined. And, more important, having that function wait on "sockets" could make the function also fit into usage of UDP sockets which doesn't have correspond stream objects.
One important detail is that the MCL OpenTransport module establishes connections for passive streams on a port in a FIFO manner. That is, the first passive stream stream created with (ccl::open-tcp-stream NIL ...) will be the first to be connected. Hence you only have to test the top queued passive tcp stream for whether it is an established connection rather than poll all the streams in the socket.
-- Terje