Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Non-blocking I/O  RSS feed

 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Recently, I wrote an email client using Java sockets (without depending on JavaMail) as an assignment of my degree program. I had a problem with the blocking state of the I/O in Java.

When I connect to a SMTP server, the length of the reply depends on the mail server. Some reply with just one line, and some many lines. Also, when connected to a remote mail server, sometimes it takes a little time to get the response.

How can I read what ever the content available in the stream and then return to the rest of the code without blocking ?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For non-blocking I/O, you can take a look at the Java nio (New I/O) package.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!