On Apr 23, 8:28 pm, Ken Wesson <kwess...@gmail.com> wrote: > On Sat, Apr 23, 2011 at 11:26 PM, Alan <a...@malloys.org> wrote: > > On Apr 23, 4:41 pm, Ken Wesson <kwess...@gmail.com> wrote: > >> On Sat, Apr 23, 2011 at 5:30 PM, Michael Wood <esiot...@gmail.com> wrote: > >> > On 23 April 2011 17:31, Ken Wesson <kwess...@gmail.com> wrote: > >> >> On Sat, Apr 23, 2011 at 5:12 AM, Zlatko Josic <zlatko.jo...@gmail.com> > >> >> wrote: > >> >>> Hi, > >> >>> I would like to start two progams from Eclipse. One is a server and the > >> >>> other one is a client. > >> >>> I use Load Clojure file in REPL from Eclipse menu. When I start the > >> >>> server > >> >>> it never ends because > >> >>> the server has endless loop where it waits for clients. Now when I > >> >>> start the > >> >>> client programs it never > >> >>> evaluates because REPL is busy with server program. I suppose it works > >> >>> as I > >> >>> described. Maybe I am > >> >>> wrong I am not sure. > >> >>> Any ideas to overcame this situation are welcome. > > >> >> Have the server spawning function (or both, if the client is GUI) just > >> >> start a separate thread and immediately return. > > >> >> (In fact, servers normally are multithreaded anyway, aren't they, to > >> >> be able to handle multiple concurrent incoming requests.) > > >> > Well, Java servers probably are yes, but traditional Unix servers > >> > would normally fork a new process for each incoming connection. > > >> Poor man's threads. Although the insulation of each one against > >> crashes in the others might be useful when you're coding in a language > >> with memory management tools as primitive as C's. ;) > > >> > There are various ways of doing it. A separate process per client > >> > connection; a separate thread per client connection; a single > >> > process/thread handling multiple clients with select()/poll()/etc. > > >> For the first one, the JVM startup time is prohibitive; for the third > >> you need nonblocking socket I/O, which might be in Java 7 or something > >> but isn't available to us JVM-6 users. > > >http://download.oracle.com/javase/1.5.0/docs/api/java/nio/channels/pa... > > > Non-blocking socket IO has been around since 1.5, maybe even 1.4. > > Oh? Then why was there a recent thread here about how it's finally > made it into Java 7 via JSR something-or-other?
I don't know what to tell you. SocketChannel has a configureBlocking(boolean) method; Selector.selectNow is a non- blocking selector across non-blocking channels. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en