Solved

What server do I need?!

Posted on 2004-04-05
17
217 Views
Last Modified: 2010-03-31
Hi everybody,
I have written an client application with Swing interface, that reads and writes some data to MySQL database. Next to this database, on the server side, I need some kind of server that will send some messages to the clients, considering users logged on the client side. I mean when some message is intended for some user, this message to be send only to this user.
So, what kind of server do I need? RMI Server, something like servlet, or something else?
I'm not so familiar with server side technologies, that's way I'm asking you.
In my poor opinion RMI server is the best solution for me. But it will support some kind of multitasking... I suppose?!?! How to do this?
Also, I will appreciate some cool articles, related to my problem.
Thanks in advance!
Best regards,
Valeri
0
Comment
Question by:Valeri
  • 7
  • 4
  • 3
  • +1
17 Comments
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 200 total points
Comment Utility
RMI would certainly fit the bill, and so would simple sockets.

RMI: http://java.sun.com/j2se/1.4.2/docs/guide/rmi/

Sockets: http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
0
 
LVL 16

Author Comment

by:Valeri
Comment Utility
If  I use RMI I don't think that I need sockets?! Except the communication with the client this server must work permanently.... and if it is informed from the database "Send message to this user", the server must send this message immediately. So RMI is the best solution?
Best regards,
Valeri
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
>>  If  I use RMI I don't think that I need sockets?
From your point of view that assumption is correct. Under the covers RMI uses sockets, but that will be of no concern to you.

>> So RMI is the best solution?
RMI will make things a lot easier for you than sockets. RMI also has some nice features that you would be able to use, like naming and lookup.
0
 
LVL 16

Author Comment

by:Valeri
Comment Utility
Could you please send me some articles, related to managing different users(clients) in my RMI server. I suppose that I'll have to use threads. Working with threads is very difficult, so I need some code examples. Do you have any clue, where can I find such kind of articles?
Thanks in advance!
Best regards,
Valeri
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
Read the first link I provided, it has everything you need regarding RMI.

Like you stated, threading is difficult. There are many, many articles on the subject. I would recommend that you go to your local bookstore and pick up O'Reilly's books on Java Threads and on RMI.

http://www.onjava.com/ is another great resource, so is http://sys-con.com/java/ and http://java.net/
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 50 total points
Comment Utility
0
 
LVL 4

Expert Comment

by:ShannonE
Comment Utility
I would suggest using JSP instead of RMI, it should be a lot simpler. When the user logs on through their web browser, the webserver that executes the JSP code presents the user with his/her messages. What exactly is the requirements of your system?? You need to explain more clearly....

Remember: focus on requirements 1st, only then worry about how to implement it.
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
ShannonE, the requirements are that the Swing client needs to communicate with a server to receive messages.

A JSP in this case would not be a solution because a) it's html based and b) it is pull, i.e. the server can't send messages to the clients, the clients have to get the messages.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:ShannonE
Comment Utility
"the requirements are that the Swing client needs to communicate with a server to receive messages"

That's not a requirement, that's an implementation. A requirement would be something like "a user needs to register for a course, and then recieve notification of acceptance/refusal from the instructor."  In that case I would suggest JSP because it's much easier.  The user could register through the web and check his registration status through the web (eliminating need for messaging) or simply have his status emailed to him.

...Or maybe he would need message based architecture, it would depend on what he really wants to do. that's why I asked for more detail ;)
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
>> That's not a requirement, that's an implementation.
Oh, but it is a requirement. That has been made abundantly clear in the question. That it be Swing might not have been an initial requirement, but is possible. Depends on at which level you look at the requirements doesn't it!?!

>> The user could register through the web and check his registration status through the web (eliminating need for messaging) or simply have his status emailed to him.
I see no mention of this use case anywhere.

However there is a mention of messages being sent to clients, i.e. server-push, not client-pull.
0
 
LVL 16

Author Comment

by:Valeri
Comment Utility
Hi again :-)
orangehead911 is right! My client is Swing  application. I need a server, that will sent notifications to the clients, and I'm looking for the best technology. RMI, CORBA or something else, I don't know which one is the most appropriate?!?!
The only thing that I know is that I don't need something like JSP's, because I have nothing common with web browser's.
So, for now, RMI is the best solution for me or not? I think "Yes", but is there any other opinions?
Best Regards,
Valeri
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
I would vote for RMI.
0
 
LVL 16

Author Comment

by:Valeri
Comment Utility
... and I'm still looking for some good links related to RMI.
How to send message to only one or to group of users. Do I need threads on the server or not?!
If I need threads is there a links with code that explains how to use threads in this case?
Best Regards,
Valeri
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
I had posted a link for RMI examples above. You can search on the same site for threads. It has loads of examples.
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
I second mayankeagle's vote.

There are several links in this thread, plenty to start with. You could also do a search on Google: http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=java+rmi+tutorial&btnG=Google+Search

Good luck!
0
 
LVL 4

Expert Comment

by:ShannonE
Comment Utility
Valeri, if your application is going to be complex, then JMS (Java Message Service) might be a better option. You can think of it as another abstraction above RMI, in other words it'll be harder to get JMS to work, but once its working it'll be easier to develop applications.

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

(See Chapter 33 & 34 on JMS in above tutorial)
0
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
The downsides to using JMS in this case, is that an additional jar would have to be added to the client application and the server would have to be running a J2EE app server with JMS support. However, it is certainly an option.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now