
-----------------------------------
matt271
Sun May 03, 2009 8:38 am

Sockets and Threads
-----------------------------------
i want to make a download accelerator in java. 
i need to open several sockets at one time and retrieve data from them. the problem is when i read from a socket it blocks until all the data is received. 
like:

// got to here at some time
blah.read(blah);
// finished here at some later time

i want something like:

// got to here at some time
blah.istheredatayet?
// finished here at ~ same time

so i dont have to open new threads for each socket

is this possible?

-----------------------------------
OneOffDriveByPoster
Mon May 04, 2009 9:40 pm

Re: Sockets and Threads
-----------------------------------

so i dont have to open new threads for each socket

is this possible?I think the SocketChannel and Selector classes can help here.
