Re: An attempt to create NON-BLOCKING sockets

From: Lars Thomas Hansen <>
Date: Mon, 24 Jul 1995 09:05:02 -0700

>The sockets mechanism implemented in STk 2.2 works fine but has some
>missings. The one I am interested to is the capability to make non
>blocking server sockets to avoid the socket-accept-connection to stop
>the STk execution if there are no sockets to satisfy. This is a real
>problem when creating servers with GUI, that can be blocked waiting for
>a connection.

Without addressing the specifics of the code you post (don't you need to
pass #t as the second argument to 'make-server-socket' to set O_NDELAY?),
I have some general comments.

In my view, you really want multithreading here: a 'server thread'
blocks on the socket until a connection is available, and other threads
will compute unhindered in the mean time. I have implemented a
preemptive tasking system for STk (2.1.7 so far, should work (possibly
with minor changes) with 2.2 but I haven't yet tried); the system is
currently being tested by a few people, and I use it with sockets in the
manner I described above. If you are interested in being an *alpha*
tester you can get the file from

There are instructions included.

(Note to all: this release is _only_ intended for people who are
familiar with threads programming and STk internals. There Will Be
Bugs. I haven't the time to help you learn either of these. That said,
the more testers the better :-)

Received on Mon Jul 24 1995 - 18:10:36 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST