I may be missing your point, but sdselect does take a time
to wait argument -- from a thing that I worked out 5 years ago:
require 'socket' NB. J system code for sockets
('jsocket';'jdefs';copath'base') copath 'base' NB. Just for convenience.
NB. All names beginning with "sd" are from J system/main/socket.ijs
.....
NB. set up socket connections
sdcleanup'' NB. Start with a clean slate er..r socket
bs =: {.;sdcheck sdsocket '' NB. Get my Base Socket for listening.
sdcheck sdbind bs;2;rip;port NB. bind my port, socket, etc.
sdcheck sdlisten bs,3 NB. We listen (up to a max queue of 3)
wait =: 60000 NB. Wait time in milliseconds - this is very arbitrary.
while. (0=>0{sds =: sdselect bs;'';'';wait) do. NB. This could go
on forever...
happy to supply more (or the entire multi-socket listening
program) if you're interested. It was a server set up to
listen for incoming data from medical devices and then
populated a database that was accessed from a web site.
Too bad the project died for other reasons, this part
worked quite well and seemed very stable.
- joey
At 10:09 +0800 2007/11/26, bill lam wrote:
Can't timer be implemented by callback instead of event loop?
I just need timer to check socket select.
Oleg Kobchenko wrote:
Timer is based on message loop, which there is none in console.
The read/eval/print loop has blocking read. So perhaps you need
read with timeout?
Oleg
On Nov 25, 2007, at 10:56, bill lam <[EMAIL PROTECTED]> wrote:
current wd'timer' depends on wd which only available in c++ or java
frontend therefore timer function can not used in jconsole. Would
it be possible to implement timer as a new foreign (ibeam) function?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm