Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

does anyone know how to write an NIO provider?  RSS feed

 
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.
 
Bartender
Posts: 9493
12
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: 9493
12
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: 9493
12
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.
 
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!