1

I'm working on a program where part of it will be working as a chat between different people. I'm trying to figure out the best way to send and receive messages.

A PrintWriter or something similar won't work because the process will stop at the read() method while waiting for a message to be sent to it. I'd like to check to see if there is a new message, and if not, continue the execution.

I've seen some stuff about JMS, but I haven't done enough research to determine if it's up for this job.

Is JMS the best option for this, or is there a better way?

asked Sep 21, 2011 at 17:40
4
  • Questions about software design decisions are fine here. Commented Jan 12, 2012 at 12:00
  • Can you tell us more about the application? Is it a desktop application or a web application? Peer-to-peer, client-server, or some other architecture? Commented Jan 12, 2012 at 12:16
  • Hello Thomas. Thanks for response but I have already decided to use JGroups. Commented Jan 13, 2012 at 23:19
  • I find JMS to be a solution from this discussion at <a href="stackoverflow.com/questions/1035949/… Overflow</a>. Commented Jun 24, 2013 at 15:13

3 Answers 3

0

You might want to check Netty.

Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients. It greatly simplifies and streamlines network programming such as TCP and UDP socket server.

answered Jan 12, 2012 at 13:08
1

You'll want to read up on Java's networking I/O but if you can't use Java 7 then you might want to look into this question/answer

HTH

answered Sep 21, 2011 at 18:03
1

If your project is a web project (like gwt or jsf), you can use reverse ajax to receive the messages in client side.

answered Sep 21, 2011 at 19:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.