Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

does anyone know how to write an NIO provider?

 
Elihu Smails
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been searching the internet and cannot find an example, tutorial or just documentation that shows what must be done.

If anyone has anything that might help me, I would appreciate it.

Thanks.
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly what are you trying to do? Searching for "NIO Provider" produced a single interesting result and that doesn't really clear anything up.
 
Elihu Smails
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to write a unix domain socket provider for NIO.
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would this provider do that java.net.Socket doesn't already?
 
Elihu Smails
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bind to, listen, read and write to a unix domain socket.
 
Joe Ess
Bartender
Posts: 9302
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, domain as opposed to internet sockets. Perhaps you could hack j-buds to support NIO or just use java.nio.SocketChannel on the loopback IP address.
Do you really need NIO-specific features (i.e. non-blocking sockets)? If not, there's really no compelling reason to use NIO instead of the java.io/java.net classes.
 
Elihu Smails
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is on loopback. The reason for selecting unix domain sockets over TCP is that unix domain sockets are faster than TCP.

Also, I was hoping to poll a tcp-based connection and a unix domain socket connection with one call to poll(), instead of 2.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic