Solved

Developing Instant Messenging in J2ME

Posted on 2003-10-29
15
1,062 Views
Last Modified: 2012-08-13
Hi, I'm trying to develop an IM using J2ME.

So i need to build an IM server, IM MIDlet client install in my mobile.
The tools i'm using is JBuilder with Mobile set and Tomcat server.

So what else do i need ?
If i have a wireless card install in my notebook, is it poosible that my mobile are able to communicate with my notebook? How?

Is urgent.
Thanks a lot.
0
Comment
Question by:crasher88
  • 9
  • 6
15 Comments
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
You have everything you need.  I've written a chat system using J2ME talking to a Tomcat server.  You might find that the concept of IM is quite tricky to implement since there is no concept of "push" technology in J2ME (MIDP-1.0).  This means that you are going to have to constantly poll the server to find out if any new messages are available.  There are two issues here:

1) If the client handset is using GSM to connect to the network, the user will have to be paying for the call whilst they use the system.

2) If the client handset is using GPRS to connect to the network, the user will have to pay for all the data transferred to and from the server.  This means that you need to be careful about the frequency and size of network traffic.

Your mobile can't communicate with your notebook through your wireless card.  The mobile isn't on the local area network.

If you want to do this, you might be able to use bluetooth, but you'll need a bluetooth card for your PC and a mobile that has support for the J2ME bluetooth APIs.
0
 

Author Comment

by:crasher88
Comment Utility
If i can't connect mobile and notebook together, then i'll use J2ME Wireless Toolkit from Sun Microsystems. They have a simulator to help me test on it.

Is it poosible to do that? How?
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Yes.  The J2ME toolkit has a built in simulator and a variety of devices (from minimum phone up to large full-colour phones).

Just make sure you have the normal Java 2 SDK installed first (1.3.1 or higher)

Then download and install the J2MEWTK (1.0.4 if you want MIDP1.0 support for current phones or 2.0 if you want MIDP2.0 support for phones that are only just being released).

You can install both and there are no conflicts.
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
If that's all for now, could you "accept" an answer to close the question ;-)

Thanx.

Jim.
0
 

Author Comment

by:crasher88
Comment Utility
jimmack, what you told me i have already know it.

Maybe i didn't clearly ask my question.
My question is how does J2ME WTK works? How it really works? From what i can see, it just compile, build and executes.

What i want to know is, the inner of J2ME WTK. How does the simulator works?

In my developing of IM, how does the client and server communicates? How it works?

Thanks.
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
How the chat system should work...
The server must sit and wait for connections to be requested.  If you're using a read-made http server (eg. I use Tomcat), then you can create a servlet to handle connection requests.  When a request is received, the server needs to be maintaining a list of users and rooms.  If the users is posting a message, it should be written to the room to be made available to other users in that room.  If the user is requesting messages, all appropriate messages in the room should be returned to the user.
The client application needs to know the URL of the server and the format of the parameters that should be sent.  It should allow users to create and send messages and should also allow them to see the messages in a room.

How the client and server communicate...
Using standard http URLs for the communication is easier than writing your own server from scratch.

How the J2ME WTK works...
Basically just what you've said.  The wtk allows you to compiler the Java code you create, it helps to manage your projects, creates the jar file with the correct details and allows you to emulate the application.  How the emulator works is not relevant.  If you are interested in ensuring that an application works on a specific kind of phone (eg. Nokia), then download the proprietary development kit for that manufacturer/phone.
When you run a network enabled application on the emulator, it will be able to access a server on your local machine or network and on the Internet, just as you can with your web browser.
0
 

Author Comment

by:crasher88
Comment Utility
Thanks alot jimmack. It really helps me in getting to know more about developing the IM application.

One more thing, Is there any interface (eg. a screen, a log file to keep any record of sessions) in the server side?

Do you mind to print screen the interface of the server side with client side and send it to me? My email address is patrick_sor@hotmail.com

After that the points is yours.

Thanks...

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 15

Expert Comment

by:jimmack
Comment Utility
I manage the sessions (rooms) in a MySQL database.

If you want to see the interface, you can look at the user guide:

http://www.ossmobile.co.uk/mCOM/mCOM_User_Guide.jsp
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Is that what you wanted?
0
 

Author Comment

by:crasher88
Comment Utility
Is there any server-side interface?

Sorry for the trouble, but i need it to do my research for the IM application...

Thanks a lot..
0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Yes.  Sorry, when I read your last comment again, I realised that was what you actually asked for ;-)

Basically it's a JSP that contains a table.  The table is two columns wide.  One each row I have a text area that contains the complete content of the "room" and in the second column I have a list of the users that are active in the room (in another text area).

A second JSP page allows me to enter messages for users to pick up when they next contact the server.

I would give you access to the administration pages, but I'm currently discussing the sale of the application ;-)
0
 

Author Comment

by:crasher88
Comment Utility
jimmack, as you have said, You maintain a room in a chat system, but in instant messaging? How to I do it? Chat is a little different from instant messaging. I pass the message straight to the other user or I store it in the database?

Ok, lets say I want to sent a message from mobile1 to mobile2. How do I do that? Can I point to the username that is unique so that it will sent to the specific user?


Can you please explain in more detail regarding the format of the parameters that should be sent?
0
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
Comment Utility
That's the key to the problem of Instant Messaging on mobile handsets.  Originally I wanted to implement an instant messaging system and discovered that there is no practical solution (as far as I am concerned).

The handset needs to poll the server at regular intervals to see if there is a new message.  Unless you're polling every couple of seconds, it's not going to look to "instant" :-(  However, if you do poll that frequently, you'll probably find that users get annoyed with how much data they transmit/receive and also, the requests will probably overlap due to network latency.

My chat application does a check (http request) every 30 seconds (or greater) depending upon what the user selects.  By default, the user needs to check manually.

This is all because there is no way to "push" information from the server to a mobile.  It looked like this was going to be solved by MIDP-2.0, but in reality, the only push technology that is going to be generally supported is via SMS.  This is because the network operators are not willing or able to provide an IP address for every mobile connected to the network.  To be honest, I don't expect this to happen until some time after IPv6 has been adopted as a general standard (probably 4 - 5 years at least).

When my app sends an http request, it includes the user ID and any message that is being sent with the request.  The server knows which "room" the user is in and can add the new message and return any outstanding messages that the user has not yet received.

The closest you will get to an Instant Messenger is to have an idea similar to my chat, but everyone will effectively be in a single room.  Instead of the room messages being sent between users, each message will need a destination user.
0
 

Author Comment

by:crasher88
Comment Utility
Thank you jimmack.
How to contact you? If i have questions regarding this project, can i email you and ask for your opinions?

Here's your points. Thanks a lot.

0
 
LVL 15

Expert Comment

by:jimmack
Comment Utility
Thanx ;-)

Probably best to ask further questions in this TA.  It's against EE policy to take discussions away from the community.  However, I'll probably be around and I always check this TA for new questions.

You might find other experts with different opinions or ideas that may even be more suitable for your needs at the time ;-)

Good luck with the project :-)
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

In this article I will describe how to setup a Cisco WLC 5508 to work with Apple's Bonjour protocol across VLANs.  I will also discuss using screen mirroring and Airplay on an AppleTV v3.  This article covers the wireless network only and requires m…
This subject  of securing wireless devices conjures up visions of your PC or mobile phone connecting to the Internet through some hotspot at Starbucks. But it is so much more than that. Let’s look at the facts: devices#sthash.eoFY7dic.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

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