Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8624999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:40:24+00:00 2026-06-12T07:40:24+00:00

I am developing a peer to peer application. in that each peer has one

  • 0

I am developing a peer to peer application.
in that each peer has one server socket channel and a socket channel,..
Now i need two selectors to handle the connection for server socket channel and socket channel,…

SelectorProvider seems to be a singleton class and it fices only a single instance of Selector,.. which i cant able to use for both the socket channel,..

is there a way to use two selectors in a single instance of a program,..

private ServerSocketChannel svrScktChnl;
private SocketChannel socketChannel;

two selector

public Selector selector=null;
public Selector playerSelector=null;

i am try to intialize these selector separately one for server socket channel and another for socket channel,..

But i cant initialize once again because it throws an error,,..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:40:25+00:00Added an answer on June 12, 2026 at 7:40 am

    Now i need two selectors to handle the connection for server socket channel and socket channel,…

    No you don’t. You can use the same Selector for both, unless for some reason not stated here you want to handle them in separate threads, which is really a violation of everything that NIO stands for.

    SelectorProvider seems to be a singleton class

    False. SelectorProvider.provider() returns a singleton, but you don’t need to use it: there are APIs everywhere that let you specify your own provider. Not that it’s relevant, because:

    and it fices only a single instance of Selector

    False. I don’t know what you mean by ‘fices’, but SelectorProvider.openSelector() returns a new Selector every time you call it, which you could have discovered for yourself without the luxurious technique of posting a question here and waiting possibly forever for a possibly incorrect answer, even if the Provider itself was a singleton, which it isn’t.

    .. which i cant able to use for both the socket channel,..

    No. Clearly you’ve never actually tried it. You need to understand that this is an empirical science where you are expected to conduct your own experiments. Posting questions on Internet sites and sitting back waiting for the answers is not an efficient use of your time or anybody else’s, and it is not calculated to deliver the correct answer as quickly as doing your own work.

    it throws an error

    You can’t seriously expect anyone to help you with as little information as that. Would you accept that as a bug report from a customer?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iam developing one application.In that i need to get the music files from the
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
While developing an application using gwt in ecliplse crashed. Now the server is running
Developing an MVC application, i now need to have test other browser versions. Installed
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
Developing rails has become lots of fun over the year that I've done it,
Developing for iPhone, I have a collection of points that I need to make
I am developing an application and trying to use an peer-to-peer communication. i have
Developing a network application, I have a Connection class that manages sending and receiving
Developing an application for Android, i want to record data that will be usefull

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.