From: Alan Manuel K. Gloria
Subject: Doing a poll loop on a trivial-sockets:open-server server (with portability requirement).
Date: 
Message-ID: <1145371113.789473.76080@v46g2000cwv.googlegroups.com>
After my Holy Week fixing up ASDF and ASDF-INSTALL, I've downloaded
:trivial-sockets and have hacked a few bits of it together.

In any case, I need to do a polling loop.  While doing some processing
(in a cooperative multitasking sort of way), I need to check for new
connections.  Unfortunately, 'trivial-socket:accept-connection waits
for a connection until one arrives - I can't allow that, since I need
to do other processing.

On my CLISP 2.38 system, the function 'socket:socket-wait can check if
a connection is already pending on the socket-server.  It (seems to
be|is) compatible with the :trivial-sockets package on CLISP:

(defun new-connection-p (server)
  #+clisp (socket:socket-wait server 0 0)
  #-clisp t)

I'd like to know what the equivalent would be on other systems, because
I'm not sure I've settled on CLISP (threads look like really really
delicious icing on the SBCL cake... but I'm too lazy to figure out how
to make unix run on my WinXP...), but I'd like to write some code NOW,
not when I've picked myself off my lazy, Windows-sticking ass.

In any case, I'm wondering if a better, portable sockets library out
there already has polling for new connections.  I like trivial-sockets'
simplicity, but I haven't hit any of its limitations yet, and I wonder
just how bad its limitations are.  Can anyone enlighten me on this?