Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sockets and Threads
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
matt271




PostPosted: Sun May 03, 2009 8:38 am   Post subject: 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?
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Mon May 04, 2009 9:40 pm   Post subject: Re: Sockets and Threads

matt271 @ Sun May 03, 2009 8:38 am wrote:

so i dont have to open new threads for each socket

is this possible?
I think the SocketChannel and Selector classes can help here.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: