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 7420631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:16:19+00:00 2026-05-29T08:16:19+00:00

I am looking to build an instant messenger in Java. Clients will connect to

  • 0

I am looking to build an instant messenger in Java.

  1. Clients will connect to the server to log in.
  2. They will start a conversation with one or more other clients.
  3. They will then post messages to the server that will relay the messages to all the clients.

The client needs to be continually updated when users post messages or log in.

so the way I see it, the client needs to run a server itself in a separate thread so that the main server can send stuff to it. Otherwise the client will have to the poll the main server every xyz seconds to get the latest updates. And that would need a separate thread anayway, as that would be purely for getting updates whereas the ‘main’ thread would be used for when the client initiates actions such as posting messages/inviting others to conversations etc…

So anyone recommendations on how to write this instant messenger? Does it sound like a good idea to make the connection a ‘two-way’ connection where both the client and server act as servers? Or is polling a better option? Anyone know how the IRC protocol does this?

  • 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-05-29T08:16:20+00:00Added an answer on May 29, 2026 at 8:16 am

    There’s no real advantage of having 2 connections unless they can be handled independently (for example receiving / sending a file usually done in a separate connection). A connection itself is already a two-way communication channel so it can be used to both send and receive messages, events etc. You don’t need to poll server since client is able to maintain persistent connection and just wait for data to appear (optionally sending periodic PING-like message to ensure connection is alive).

    IRC uses a single connection to server to exchange text commands. For example one of the main commands:

    PRIVMSG <msgtarget> <message>
    

    This command can be originated either by client or by server. Client sends PRIVMSG to notify that it wants to deliver message to one or more destination (in IRC this either user(s) or channel(s)). Server’s task here is to properly broadcast this message to appropriate clients.

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

Sidebar

Related Questions

I am looking to build a new website which will require a sql server
I'm looking to build a query that will use the non-clustered indexing plan on
I'm looking to build a server with lots of tiny files delivered by an
I'm looking to build a flyout type menu in Silverlight that will be added
I'm looking to build an ASP.NET MVC application where many screens will have multiple
We are looking to build a cube in Microsft SQL server analysis services but
I'm looking to build a lob application, which will have to run on Windows
I'm looking to build a dynamic website without bringing much extra server-side code/apps into
I am looking to build a java-style enum pattern for C# that also supports
I'm looking to build a mobile/web based team management system, it will be around

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.