On Tue, Dec 1, 2009 at 11:10 AM, Ivan Sagalaev
<man...@softwaremaniacs.org>wrote:

> Hello!
>
> I'm looking at Clojure for a couple of days, having watched two of
> Rich's video presentations. So I'm not yet familiar with Clojure's
> practical patterns but I can read the code :-).
>
> My question is how to model a non-blocking I/O. For example I want to
> request a URL over HTTP and do something with its content. I don't want
> to block on waiting for network. In my current working language Python I
>  can setup a non-blocking socket and a callback that will take care of
> parsing response in suitable small chunks. This would happen without
> occupying additional threads because I/O is a task dumb enough to be
> left for TCP/IP stack in the kernel.
>
> As I gathered from the talk on Clojure concurrency all asynchronous task
> are done using agents that are processed with threads. So it looks like
> to read from a socket asynchronously I have to do it with agents that
> will may be poll the socket in a loop. But it seems silly.
>
> What am I missing then?


The java.nio.channels package. :)

-- 
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

Reply via email to